Slide 1

Slide 1 text

No content

Slide 2

Slide 2 text

ABOUT ME > PHPBenelux > PFZ > PHPAmersfoort/PHP.FRL > Ingewikkeld > phpBB, Zend Framework, Symfony and many more

Slide 3

Slide 3 text

CONTACT @SKOOP & [email protected]

Slide 4

Slide 4 text

ONCE UPON A TIME...

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

DEPENDENCY INJECTION

Slide 7

Slide 7 text

DEPENDENCY INJECTION > No hardcoded dependencies > Easily manage and update specific classes > Program to contracts, not implementations > Minimize bootstrap code > More testable code

Slide 8

Slide 8 text

DEPENDENCY INJECTION class Foo { public function bar() { $coffee = new Coffee(); $coffee->init(); return $coffee->drink(); } }

Slide 9

Slide 9 text

DEPENDENCY INJECTION $coffee = new Coffee();

Slide 10

Slide 10 text

DEPENDENCY INJECTION $coffee->init();

Slide 11

Slide 11 text

DEPENDENCY INJECTION class Coffee implements Roastable {} class Foo { private $coffee; public function __construct(Roastable $coffee) { $this->coffee = $coffee; } }

Slide 12

Slide 12 text

DEPENDENCY INJECTION public function bar() { return $this->coffee->drink(); }

Slide 13

Slide 13 text

DEPENDENCY INJECTION parameters: coffee.class: "Coffee" foo.class: "Foo" services: coffee: class: "%coffee.class%" foo: class: "%foo.class%" arguments: - "@coffee"

Slide 14

Slide 14 text

DEPENDENCY INJECTION class DefaultController { public function fooAction() { $foo = $this->container->get('foo'); $foo->bar(); } }

Slide 15

Slide 15 text

DEPENDENCY INJECTION class DefaultController { private $foo; public function __construct(Foo $foo) { $this->foo = $foo; } public function fooAction() { $this->foo->bar(); } }

Slide 16

Slide 16 text

SERVICE LAYER OR: HOW SYMFONY IS ONLY IMPLEMENTATION

Slide 17

Slide 17 text

SERVICE LAYER > Seperation of concerns > Business logic should not be bound to the application > Service layer can be accessed through the service container

Slide 18

Slide 18 text

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 }

Slide 19

Slide 19 text

No content

Slide 20

Slide 20 text

No content

Slide 21

Slide 21 text

SERVICE LAYER HEXAGONAL ARCHITECTURE > http://php-and-symfony.matthiasnoback.nl/tags/ hexagonal%20architecture/ > http://protalk.me/the-framework-as-an- implementation-detail

Slide 22

Slide 22 text

No content

Slide 23

Slide 23 text

DOCUMENTATION

Slide 24

Slide 24 text

DOCUMENTATION > The best starting point for your search > Not the ultimate source for information

Slide 25

Slide 25 text

DOCUMENTATION > Google > Stack Overflow > Blogs > IRC

Slide 26

Slide 26 text

DOCUMENTATION > Something missing? Add it yourself! > https://github.com/symfony/symfony-docs

Slide 27

Slide 27 text

DOCUMENTATION > Symfony Rainbow Series by Joshua Thijssen > https://leanpub.com/b/symfonyrainbowseries

Slide 28

Slide 28 text

PROJECT CONFIGURATION

Slide 29

Slide 29 text

PROJECT CONFIGURATION EVERYTHING IN ITS RIGHT PLACE > config*.yml > routing*.yml > security.yml > parameters.yml

Slide 30

Slide 30 text

No content

Slide 31

Slide 31 text

PROJECT CONFIGURATION XML VS YAML > http://gowat.ch/xmlyml > http://converter.rosstuck.com/

Slide 32

Slide 32 text

CHOOSE AND STANDARDIZE

Slide 33

Slide 33 text

CHOOSE > You can do things in multiple ways > THIS IS GREAT! > Clarity, readability, maintainability

Slide 34

Slide 34 text

STANDARDIZE > Configuration: yml, xml, annotations > Controller extends or not? > Naming of services, parameters, bundles

Slide 35

Slide 35 text

PERSISTENCE

Slide 36

Slide 36 text

READY FOR ACTION?

Slide 37

Slide 37 text

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

Slide 38

Slide 38 text

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 > 3.1 - support until 01/2017, EOL 07/2017 > 3.2 - support until 07/2017, EOL 01/2018 > Next LTS: 3.4: support until 11/2020, EOL 11/2021

Slide 39

Slide 39 text

QUESTIONS?

Slide 40

Slide 40 text

I SALUTE YOU

Slide 41

Slide 41 text

I SALUTE YOU @SKOOP LEFTONTHEWEB.COM PHP.INGEWIKKELD.NET

Slide 42

Slide 42 text

I SALUTE YOU @SKOOP LEFTONTHEWEB.COM PHP.INGEWIKKELD.NET JOIND.IN: HTTPS://LEGACY.JOIND.IN/19492