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
Stefan Koopmanschap
May 24, 2016
Technology
240
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
110
PHP Kitchen Nightmares (PHP.FRL)
skoop
0
110
Sustainable open source contributions in your business (CakeFest 2024)
skoop
0
130
Domain-Driven Design: The Basics (SymfonyCon 2023, Brussels)
skoop
0
250
Domain-Driven Design: The Basics (Cakefest)
skoop
0
270
PHP Kitchen Nightmares
skoop
0
84
Domain Driven Design - The Basics (TechTuesday XXL, Tilburg)
skoop
0
130
7 Lessons You Can Learn From Disney Movies (SymfonyCon 2022)
skoop
0
320
Mental Health in the Workplace (SymfonyCon 2019, Amsterdam)
skoop
0
760
Other Decks in Technology
See All in Technology
[DroidKaigi 2026] Making UI specifications visible: Android UI development in the AI agent era supported by Compose Screenshot Testing and galleries
syarihu
0
470
20260903 Tokyo Jazug Night #62 | Azure エンジニアよ、 その環境は本当にセキュアか?
olivia_0707
1
560
「ミスを許さない手順書」を作ってみた 〜 個人的にはこれ以上できることはあまりなさそう/20260827-ssmjp-operation-procedure-update
opelab
18
17k
Genie Code ワークショップ 基礎編 / Genie-Code-Workshop-fundamental
databricksjapan
PRO
0
310
書籍『生成AIの安全性入門』の入門
wataoka
0
160
AI駆動開発をチームに根付かせる - 「1行も書かない」チームがHarnessを育てた1年 -
kenichirokimura
6
3.7k
Webとヘルスデータ
yukukotani
0
130
研究開発部の紹介 / Sansan R&D Profile
sansan33
PRO
4
25k
bet_ai_day_2026_session02
agenticsec
1
720
AIエージェントを雇う前に決める5つのこと
knishioka
1
140
APIセキュリティを組織で実現するには~注力する点と設計・実装に入れたい対策~
riiimparm
3
890
Sony-DroidKaigi2026
sony
1
290
Featured
See All Featured
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
290
SEO for Brand Visibility & Recognition
aleyda
0
4.7k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
230
23k
Site-Speed That Sticks
csswizardry
13
1.5k
Designing Experiences People Love
moore
143
24k
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
67
57k
Utilizing Notion as your number one productivity tool
mfonobong
4
560
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
35
2.8k
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
1
330
Joys of Absence: A Defence of Solitary Play
codingconduct
1
460
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
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