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
220
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
72
PHP Kitchen Nightmares (PHP.FRL)
skoop
0
83
Sustainable open source contributions in your business (CakeFest 2024)
skoop
0
110
Domain-Driven Design: The Basics (SymfonyCon 2023, Brussels)
skoop
0
230
Domain-Driven Design: The Basics (Cakefest)
skoop
0
240
PHP Kitchen Nightmares
skoop
0
75
Domain Driven Design - The Basics (TechTuesday XXL, Tilburg)
skoop
0
110
7 Lessons You Can Learn From Disney Movies (SymfonyCon 2022)
skoop
0
300
Mental Health in the Workplace (SymfonyCon 2019, Amsterdam)
skoop
0
720
Other Decks in Technology
See All in Technology
タスク管理も1on1も、もう「管理」じゃない - KiroとBedrock AgentCoreで変わった“判断の仕事”
yusukeshimizu
0
150
Sansanの認証基盤を支えるアーキテクチャとその振り返り
sansantech
PRO
1
120
MCPで決済に楽にする
mu7889yoon
0
160
Zephyr(RTOS)でARMとRISC-Vのコア間通信をしてみた
iotengineer22
0
110
Oracle AI Database@Azure:サービス概要のご紹介
oracle4engineer
PRO
4
1.3k
QA組織のAI戦略とAIテスト設計システムAITASの実践
sansantech
PRO
1
260
DMBOKを使ってレバレジーズのデータマネジメントを評価した
leveragestech
0
480
Astro Islandsの 内部実装を 「日本で一番わかりやすく」 ざっくり解説!
knj
0
350
20260326_AIDD事例紹介_ULSC.pdf
findy_eventslides
0
210
夢の無限スパゲッティ製造機 #phperkaigi
o0h
PRO
0
400
Why we keep our community?
kawaguti
PRO
0
340
Physical AI on AWS リファレンスアーキテクチャ / Physical AI on AWS Reference Architecture
aws_shota
1
200
Featured
See All Featured
Become a Pro
speakerdeck
PRO
31
5.9k
エンジニアに許された特別な時間の終わり
watany
106
240k
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
160
So, you think you're a good person
axbom
PRO
2
2k
Technical Leadership for Architectural Decision Making
baasie
3
300
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
2.5k
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.5k
Exploring anti-patterns in Rails
aemeredith
2
300
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
10k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
61k
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