Your SlideShare is downloading. ×
0
THE ONLY PHP FRAMEWORK YOULL NEED:                        SYMFONY2                            Juozas Kaziukėnas // juokaz....
Juozas Kaziukėnas, Lithuanian       You can call me Joe       Talk to me at @juokaz       More info http://juokaz.comThurs...
WhiskyWeb.co.ukThursday, November 29, 12
A CLASSIC PHP FRAMEWORKThursday, November 29, 12
WHAT A FRAMEWORK SHOULD DO?Thursday, November 29, 12
WHAT A FRAMEWORK SHOULD DO?    • Out           of the box functionality    • Routing    • Security    • Best          prac...
WHAT IT SHOULD DO, VER 2Thursday, November 29, 12
NO PHP FRAMEWORK TO DO             IT RIGHTThursday, November 29, 12
WRONG ATTEMPTS    • Hugely                coupled    • Hard            to override core behavior    • Overcomplicated    •...
FALSE                PROMISESThursday, November 29, 12
WHAT IS SYMFONY2?Thursday, November 29, 12
WHAT IS SYMFONY2?    •A        successor of symfony 1.X    • Rewritten               from scratch    • Turns            re...
COMPONENTS    • Building              blocks for the framework    • Like: HTTP  kernel, Form, Validation, Security, Event ...
SILEX    require_once __DIR__./../vendor/autoload.php;    $app = new SilexApplication();    $app->get(/hello/{name}, funct...
WHAT SYMFONY2 DOES WELL?Thursday, November 29, 12
WHAT SYMFONY2 DOES WELL?    • Components    • Inspired              Composer to be created    • Silex          vs Symfony2...
STARTING WITH SYMFONY2Thursday, November 29, 12
STARTING WITH SYMFONY2    composer.phar create-project    symfony/framework-standard-edition    path/to/install 2.1.x-dev ...
COMPOSER    • 3rd         party dependency management    • Makes                 life so much easier    • Allows          ...
BUNDLES    • “Modules” to              separate application code    • Contains              controllers, models, templates...
BUNDLES    // src/Acme/DemoBundle/Controller/WelcomeController.php    namespace AcmeDemoBundleController;    use SymfonyBu...
SERVICE CONTAINER      // app/config/config.yml    services:        my_mailer:            class:        AcmeHelloBundleMai...
COMMUNITYThursday, November 29, 12
COMMUNITY    • Symfony2                 on Twitter    • Conferences, user                groups    • All       of this?   ...
QUESTIONS?Thursday, November 29, 12
THANKS!    Juozas Kaziukėnas    http://juokaz.com/    @juokazThursday, November 29, 12
Upcoming SlideShare
Loading in...5
×

The only php framework you'll need: Symfony2 - FOWA Prague

3,782

Published on

Published in: Technology
0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
3,782
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
45
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide

Transcript of "The only php framework you'll need: Symfony2 - FOWA Prague"

  1. 1. THE ONLY PHP FRAMEWORK YOULL NEED: SYMFONY2 Juozas Kaziukėnas // juokaz.com // @juokazThursday, November 29, 12
  2. 2. Juozas Kaziukėnas, Lithuanian You can call me Joe Talk to me at @juokaz More info http://juokaz.comThursday, November 29, 12
  3. 3. WhiskyWeb.co.ukThursday, November 29, 12
  4. 4. A CLASSIC PHP FRAMEWORKThursday, November 29, 12
  5. 5. WHAT A FRAMEWORK SHOULD DO?Thursday, November 29, 12
  6. 6. WHAT A FRAMEWORK SHOULD DO? • Out of the box functionality • Routing • Security • Best practices • Standardization • Decoupling • etc.Thursday, November 29, 12
  7. 7. WHAT IT SHOULD DO, VER 2Thursday, November 29, 12
  8. 8. NO PHP FRAMEWORK TO DO IT RIGHTThursday, November 29, 12
  9. 9. WRONG ATTEMPTS • Hugely coupled • Hard to override core behavior • Overcomplicated • Low quality • Slow • million other reasonsThursday, November 29, 12
  10. 10. FALSE PROMISESThursday, November 29, 12
  11. 11. WHAT IS SYMFONY2?Thursday, November 29, 12
  12. 12. WHAT IS SYMFONY2? •A successor of symfony 1.X • Rewritten from scratch • Turns requests to responses, that’s it • Heavily utilizes PHP 5.3+ features • Component oriented architecture • Supported by Sensio Labs agency, run by Fabien PotencierThursday, November 29, 12
  13. 13. COMPONENTS • Building blocks for the framework • Like: HTTP kernel, Form, Validation, Security, Event dispatcher, Config, Console, etc. • Independent self-contained components • Can be used without using Symfony2 as a web frameworkThursday, November 29, 12
  14. 14. SILEX require_once __DIR__./../vendor/autoload.php; $app = new SilexApplication(); $app->get(/hello/{name}, function($name) use($app) { return Hello .$app->escape($name); }); $app->run();Thursday, November 29, 12
  15. 15. WHAT SYMFONY2 DOES WELL?Thursday, November 29, 12
  16. 16. WHAT SYMFONY2 DOES WELL? • Components • Inspired Composer to be created • Silex vs Symfony2 vs your own • Fully working standard distribution • Service container for dependenciesThursday, November 29, 12
  17. 17. STARTING WITH SYMFONY2Thursday, November 29, 12
  18. 18. STARTING WITH SYMFONY2 composer.phar create-project symfony/framework-standard-edition path/to/install 2.1.x-dev php ./app/console server:run Browse http://localhost:8000/app_dev.phpThursday, November 29, 12
  19. 19. COMPOSER • 3rd party dependency management • Makes life so much easier • Allows not to have 3rd party checked in into a master repo • Project-specific dependencies vs PEAR-like system-wide • One file composer.json to manage all expectations • Became a de facto standard in PHP projectsThursday, November 29, 12
  20. 20. BUNDLES • “Modules” to separate application code • Contains controllers, models, templates, etc. • Symfony framework itself is a bundle called FrameworkBundle • Repository of available bundles http://knpbundles.com/ • Can be extended to customizeThursday, November 29, 12
  21. 21. BUNDLES // src/Acme/DemoBundle/Controller/WelcomeController.php namespace AcmeDemoBundleController; use SymfonyBundleFrameworkBundleControllerController; class WelcomeController extends Controller { public function indexAction() { return $this->render(AcmeDemoBundle:Welcome:index.html.twig); } }Thursday, November 29, 12
  22. 22. SERVICE CONTAINER // app/config/config.yml services: my_mailer: class: AcmeHelloBundleMailer arguments: [sendmail] class WelcomeController extends Controller { public function sendEmailAction() { $mailer = $this->get(my_mailer); $mailer->send(ryan@foobar.net, ...); } }Thursday, November 29, 12
  23. 23. COMMUNITYThursday, November 29, 12
  24. 24. COMMUNITY • Symfony2 on Twitter • Conferences, user groups • All of this? • Good market to be a developer • Less bugs, active GitHub • DrupalThursday, November 29, 12
  25. 25. QUESTIONS?Thursday, November 29, 12
  26. 26. THANKS! Juozas Kaziukėnas http://juokaz.com/ @juokazThursday, November 29, 12
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×