Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Symfony3 Best Practices from the trenches
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Stefan Koopmanschap
May 24, 2016
Technology
1
210
Symfony3 Best Practices from the trenches
As done at PHP.FRL meetup in Heerenveen
Stefan Koopmanschap
May 24, 2016
Tweet
Share
More Decks by Stefan Koopmanschap
See All by Stefan Koopmanschap
How to make good decisions with a happy team (SymfonyCon 2025)
skoop
0
51
PHP Kitchen Nightmares (PHP.FRL)
skoop
0
73
Sustainable open source contributions in your business (CakeFest 2024)
skoop
0
97
Domain-Driven Design: The Basics (SymfonyCon 2023, Brussels)
skoop
0
220
Domain-Driven Design: The Basics (Cakefest)
skoop
0
230
PHP Kitchen Nightmares
skoop
0
66
Domain Driven Design - The Basics (TechTuesday XXL, Tilburg)
skoop
0
110
7 Lessons You Can Learn From Disney Movies (SymfonyCon 2022)
skoop
0
290
Mental Health in the Workplace (SymfonyCon 2019, Amsterdam)
skoop
0
710
Other Decks in Technology
See All in Technology
KubeCon + CloudNativeCon NA ‘25 Recap, Extensibility: Gateway API / NRI
ladicle
0
160
新規事業における「一部だけどコア」な AI精度改善の優先順位づけ
zerebom
0
440
Amazon Bedrock AgentCore 認証・認可入門
hironobuiga
2
470
漸進的過負荷の原則
sansantech
PRO
3
430
GCASアップデート(202510-202601)
techniczna
0
230
Azure SQL Databaseでベクター検索を活用しよう
nakasho
0
130
2人で作ったAIダッシュボードが、開発組織の次の一手を照らした話― Cursor × SpecKit × 可視化の実践 ― Qiita AI Summit
noalisaai
1
320
Amazon S3 Vectorsを使って資格勉強用AIエージェントを構築してみた
usanchuu
3
390
月間数億レコードのアクセスログ基盤を無停止・低コストでAWS移行せよ!アプリケーションエンジニアのSREチャレンジ💪
miyamu
0
580
ゼロから始めたFindy初のモバイルアプリ開発
grandbig
2
580
GSIが複数キー対応したことで、俺達はいったい何が嬉しいのか?
smt7174
3
120
コスト削減から「セキュリティと利便性」を担うプラットフォームへ
sansantech
PRO
1
510
Featured
See All Featured
First, design no harm
axbom
PRO
2
1.1k
sira's awesome portfolio website redesign presentation
elsirapls
0
140
The SEO identity crisis: Don't let AI make you average
varn
0
62
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.3k
Building the Perfect Custom Keyboard
takai
2
680
A Soul's Torment
seathinner
5
2.2k
Tell your own story through comics
letsgokoyo
1
800
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
0
130
Heart Work Chapter 1 - Part 1
lfama
PRO
5
35k
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
0
190
A designer walks into a library…
pauljervisheath
210
24k
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
88
Transcript
None
About me » PHPBenelux » PFZ » PHPAmersfoort/PHP.FRL » Ingewikkeld
» phpBB, Zend Framework, Symfony and many more
Once upon a time...
None
Dependency Injection
Dependency Injection » No hardcoded dependencies » Easily manage and
update specific classes » Program to contracts, not implementations » Minimize bootstrap code » More testable code
Dependency Injection class Foo { public function bar() { $coffee
= new Coffee(); $coffee->init(); return $coffee->drink(); } }
Dependency Injection $coffee = new Coffee();
Dependency Injection $coffee->init();
Dependency Injection class Coffee implements Roastable {} class Foo {
private $coffee; public function __construct(Roastable $coffee) { $this->coffee = $coffee; } }
Dependency Injection public function bar() { return $this->coffee->drink(); }
Dependency Injection parameters: coffee.class: "Coffee" foo.class: "Foo" services: coffee: class:
"%coffee.class%" foo: class: "%foo.class%" arguments: - "@coffee"
Dependency Injection class DefaultController { public function fooAction() { $foo
= $this->container->get('foo'); $foo->bar(); } }
Dependency Injection class DefaultController { private $foo; public function __construct(Foo
$foo) { $this->foo = $foo; } public function fooAction() { $this->foo->bar(); } }
Service layer Or: How Symfony is only implementation
Service layer » Seperation of concerns » Business logic should
not be bound to the application » Service layer can be accessed through the service container
Service layer public function showAction($productId) { $product = $this->getDoctrine() ->getRepository('AppBundle:Product')
->find($productId); if (!$product) { throw $this->createNotFoundException( 'No product found for id '.$productId ); } // ... do something, like pass the $product object into a template }
None
None
Service Layer Hexagonal architecture » http://php-and-symfony.matthiasnoback.nl/tags/ hexagonal%20architecture/ » http://protalk.me/the-framework-as-an- implementation-detail
None
Documentation
Documentation » The best starting point for your search »
Not the ultimate source for information
Documentation » Google » Stack Overflow » Blogs » IRC
Documentation » Something missing? Add it yourself! » https://github.com/symfony/symfony-docs
Documentation » Symfony Rainbow Series by Joshua Thijssen » https://leanpub.com/b/symfonyrainbowseries
Project Configuration
Project Configuration Everything in its right place » config*.yml »
routing*.yml » security.yml » parameters.yml
None
Project Configuration XML vs yaml » http://gowat.ch/xmlyml » http://converter.rosstuck.com/
Choose and Standardize
Choose » You can do things in multiple ways »
THIS IS GREAT! » Clarity, readability, maintainability
Standardize » Configuration: yml, xml, annotations » Controller extends or
not? » Naming of services, parameters, bundles
Ready for action?
Ready for action? » Use bundles correctly » Maximize external
library usage » Avoid |raw » .gitignore your parameters.yml » Translate! » Log all the things! » Stay up-to-date
Up-to-date » 2.7 - support until 05/2018, EOL 05/2019 »
2.8 - support until 11/2018, EOL 11/2019 » 3.0 - support until 07/2016, EOL 01/2017 » Next LTS: 3.4: support until 11/2020, EOL 11/2021
Questions?
I Salute You
I Salute You @skoop leftontheweb.com php.ingewikkeld.net