Slide 1

Slide 1 text

!Symfony2:!It’s!Play!Time! @geoffreytran! www.linkedin.com/in/geoffreytran!

Slide 2

Slide 2 text

What!is!Symfony2?! It!simply!solves!your!difficult!redundant!problems! …!and!gets!out!of!your!way!

Slide 3

Slide 3 text

You!are!not!boxed!in…!

Slide 4

Slide 4 text

…!easy!to!get!started,!yet!powerful!and!flexible!for! advanced!users!

Slide 5

Slide 5 text

Pre!Zend_ApplicaNon!Bootstrap! Index.php!

Slide 6

Slide 6 text

Post!Zend_ApplicaNon! Index.php!

Slide 7

Slide 7 text

“The core architecture is now stable…” – Fabien Potencier hPp://symfony.com/blog/symfony2QfinalQversionQweQareQnotQthereQyet!

Slide 8

Slide 8 text

In!development!since!December!2009!

Slide 9

Slide 9 text

A!lot!can!happen! in!a!year! A"baby?"

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

Top"2%"of"projects"on"Ohloh"

Slide 12

Slide 12 text

325"Bundles"Published" h>p://symfony2bundles.org/"

Slide 13

Slide 13 text

What!exactly!is!a!bundle?! A!bundle!is!like!a!plugin! …!except!Symfony2!itself!is!made!up!of!bundles!

Slide 14

Slide 14 text

“I!was!using!the!same!idea!by!organizing!my!code!in![zend!framework]! modules,!but!this!is!really!painful”! QQ!tawfekov!via!StackOverflow! ! hPp://stackoverflow.com/quesNons/5053369/doQyouQthinkQzendQframeworkQmissesQtheQsymfonysQbundleQprinciple!

Slide 15

Slide 15 text

Nothing!like!Symfony1!

Slide 16

Slide 16 text

Less!Magic! config_autoload.yml.php!

Slide 17

Slide 17 text

Explicit!ConfiguraNon! app/AppKernel.php!

Slide 18

Slide 18 text

Doctrine2! Doctrine2:!User.php! Doctrine!1.2:!User.php!

Slide 19

Slide 19 text

Decoupled!design!

Slide 20

Slide 20 text

No content

Slide 21

Slide 21 text

No content

Slide 22

Slide 22 text

No content

Slide 23

Slide 23 text

No content

Slide 24

Slide 24 text

What makes up Symfony2? ConfiguraNon! Kernel! Directory! Structure! Symfony!Framework!Bundles! Symfony!Components!

Slide 25

Slide 25 text

Getting started with Symfony2 distributions Similar!to!Linux!distribuNons!

Slide 26

Slide 26 text

hPp://symfony.com/download!

Slide 27

Slide 27 text

#!cd!~/Projects/LoneStarPHP! #!tar!xvzf!/path/to/Symfony_Standard_Vendors_2.0.0BETA4.tgz! Extract to your web directory

Slide 28

Slide 28 text

Check requirements hPp://yourhost/LoneStarPHP/web/config.php! Not!accessing!from!localhost?!! Remove!the!security!check! from:! web/config.php" web/app_dev.php"

Slide 29

Slide 29 text

Check requirements hPp://yourhost/LoneStarPHP/web/config.php!

Slide 30

Slide 30 text

Check requirements hPp://yourhost/LoneStarPHP/web/config.php!

Slide 31

Slide 31 text

Check requirements hPp://yourhost/LoneStarPHP/web/config.php!

Slide 32

Slide 32 text

Check requirements hPp://yourhost/LoneStarPHP/web/config.php!

Slide 33

Slide 33 text

Configure the database connection hPp://yourhost/LoneStarPHP/web/app_dev.php/_configurator/step/0! You!can!write!your! own!configuraNon! files!instead!

Slide 34

Slide 34 text

Yay, Welcome to Symfony! hPp://yourhost/LoneStarPHP/web/app_dev.php!

Slide 35

Slide 35 text

What!makes!a!page?! /hello/world" A!Route! !/hello/{name}" A!Controller! !A!PHP!funcNon! A!Response! !“

Hello!World!

”!

Slide 36

Slide 36 text

Step!1:!Create!a!route! /hello/world" File:"app/config/rouKng.yml" ! ! *!RouNng!can!also!be!defined!with!XML,!PHP!and!as!annotaNons! AcmeDemoBundle:LoneStar:hello!! maps!to! !Acme\DemoBundle\Controller\LoneStarController::helloAcNon()!

Slide 37

Slide 37 text

Step!2:!Create!a!controller! /hello/world" File:"src/Acme/DemoBundle/Controller/LoneStarController.php" ! ! *!At!its!simplest,!a!controller!is!just!a!funcNon!

Slide 38

Slide 38 text

Step!2:!Create!a!controller! /hello/world" File:"src/Acme/DemoBundle/Controller/LoneStarController.php" ! ! File:"app/config/rouKng.yml" ! !

Slide 39

Slide 39 text

/hello/world! hPp://yourhost/LoneStarPHP/web/app_dev.php/hello/world!

Slide 40

Slide 40 text

Great…!! But!HTML!in!controllers?!&@*$%!""

Slide 41

Slide 41 text

Meet!Twig" hPp://www.twigQproject.org! src/Acme/DemoBundle/Resources/views/LoneStar/hello.html.twig! src/Acme/DemoBundle/Controller/LoneStarController.php!

Slide 42

Slide 42 text

Hello!World!" hPp://yourhost/LoneStarPHP/web/app_dev.php/hello/world!

Slide 43

Slide 43 text

Digging!Deeper" hPp://yourhost/LoneStarPHP/web/app_dev.php/hello/world!

Slide 44

Slide 44 text

Digging!Deeper" hPp://yourhost/LoneStarPHP/web/app_dev.php/hello/world!

Slide 45

Slide 45 text

Do!less!work! /hello/world" File:"src/Acme/DemoBundle/Controller/LoneStarController.php" ! !

Slide 46

Slide 46 text

Give"it"a"try…"