Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Symfony3 Best Practices from the trenches
Search
Stefan Koopmanschap
May 24, 2016
Technology
250
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Symfony3 Best Practices from the trenches
As done at PHP.FRL meetup in Heerenveen
Stefan Koopmanschap
May 24, 2016
More Decks by Stefan Koopmanschap
See All by Stefan Koopmanschap
How to make good decisions with a happy team (SymfonyCon 2025)
skoop
0
120
PHP Kitchen Nightmares (PHP.FRL)
skoop
0
120
Sustainable open source contributions in your business (CakeFest 2024)
skoop
0
140
Domain-Driven Design: The Basics (SymfonyCon 2023, Brussels)
skoop
0
260
Domain-Driven Design: The Basics (Cakefest)
skoop
0
280
PHP Kitchen Nightmares
skoop
0
93
Domain Driven Design - The Basics (TechTuesday XXL, Tilburg)
skoop
0
150
7 Lessons You Can Learn From Disney Movies (SymfonyCon 2022)
skoop
0
330
Mental Health in the Workplace (SymfonyCon 2019, Amsterdam)
skoop
0
760
Other Decks in Technology
See All in Technology
AIがGISを代替する日:〜すべてをAIが創る時代に、私たちがFOSS4Gに関わる意味〜
lehupa
1
210
素人でもできた!AIを使った短編小説創作入門
delhi09
PRO
0
310
eBPF 簡介 2026 版
shunghsiyu
0
180
E2Eってつらくないですか?E2Eの管理コストを下げる手段とその実践
akaboshinit
6
3k
コードレビューをなくして見えたもの
henteko
0
130
Building Audio Plugin Ecosystem for Android in 2026
atsushieno
2
140
自律的なチームを作るためにTechPMがやらないこと
ny7760
1
510
re:Invent の去年のスケジュールを公開します!
miu_crescent
PRO
0
280
生成AI時代のIAMのマニアックな話
takuros
4
340
Oracle Database Security 詳細解説
oracle4engineer
PRO
1
250
AWSを利用する上で知っておきたい名前解決の話 2026
nagisa53
2
360
In-Context Learning再入門。ICLの勾配降下的解釈の研究動向を追ってみる。
dai08srhg
1
240
Featured
See All Featured
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
480
Navigating Weather and Climate Data
rabernat
0
580
The Curious Case for Waylosing
cassininazir
1
610
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.7k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.9k
How to Talk to Developers About Accessibility
jct
2
610
Agile that works and the tools we love
rasmusluckow
331
22k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.9k
Designing Powerful Visuals for Engaging Learning
tmiket
1
640
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
610
エンジニアに許された特別な時間の終わり
watany
109
250k
The Limits of Empathy - UXLibs8
cassininazir
2
760
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