the only php framework you'll need: symfony2 - fowa prague
TRANSCRIPT
![Page 1: The only php framework you'll need: Symfony2 - FOWA Prague](https://reader034.vdocuments.us/reader034/viewer/2022052505/554f7818b4c905435d8b4576/html5/thumbnails/1.jpg)
THE ONLY PHP FRAMEWORK YOU'LL NEED:
SYMFONY2Juozas Kaziukėnas // juokaz.com // @juokaz
Thursday, November 29, 12
![Page 2: The only php framework you'll need: Symfony2 - FOWA Prague](https://reader034.vdocuments.us/reader034/viewer/2022052505/554f7818b4c905435d8b4576/html5/thumbnails/2.jpg)
Juozas Kaziukėnas, Lithuanian
You can call me Joe
Talk to me at @juokaz
More info http://juokaz.com
Thursday, November 29, 12
![Page 3: The only php framework you'll need: Symfony2 - FOWA Prague](https://reader034.vdocuments.us/reader034/viewer/2022052505/554f7818b4c905435d8b4576/html5/thumbnails/3.jpg)
WhiskyWeb.co.uk
Thursday, November 29, 12
![Page 4: The only php framework you'll need: Symfony2 - FOWA Prague](https://reader034.vdocuments.us/reader034/viewer/2022052505/554f7818b4c905435d8b4576/html5/thumbnails/4.jpg)
A CLASSIC PHP FRAMEWORK
Thursday, November 29, 12
![Page 5: The only php framework you'll need: Symfony2 - FOWA Prague](https://reader034.vdocuments.us/reader034/viewer/2022052505/554f7818b4c905435d8b4576/html5/thumbnails/5.jpg)
WHAT A FRAMEWORK SHOULD DO?
Thursday, November 29, 12
![Page 6: The only php framework you'll need: Symfony2 - FOWA Prague](https://reader034.vdocuments.us/reader034/viewer/2022052505/554f7818b4c905435d8b4576/html5/thumbnails/6.jpg)
WHAT A FRAMEWORK SHOULD DO?
•Out of the box functionality• Routing• Security• Best practices• Standardization•Decoupling• etc.
Thursday, November 29, 12
![Page 7: The only php framework you'll need: Symfony2 - FOWA Prague](https://reader034.vdocuments.us/reader034/viewer/2022052505/554f7818b4c905435d8b4576/html5/thumbnails/7.jpg)
WHAT IT SHOULD DO, VER 2
Thursday, November 29, 12
![Page 8: The only php framework you'll need: Symfony2 - FOWA Prague](https://reader034.vdocuments.us/reader034/viewer/2022052505/554f7818b4c905435d8b4576/html5/thumbnails/8.jpg)
NO PHP FRAMEWORK TO DO IT RIGHT
Thursday, November 29, 12
![Page 9: The only php framework you'll need: Symfony2 - FOWA Prague](https://reader034.vdocuments.us/reader034/viewer/2022052505/554f7818b4c905435d8b4576/html5/thumbnails/9.jpg)
WRONG ATTEMPTS
• Hugely coupled
• Hard to override core behavior
•Overcomplicated
• Low quality
• Slow
•million other reasons
Thursday, November 29, 12
![Page 10: The only php framework you'll need: Symfony2 - FOWA Prague](https://reader034.vdocuments.us/reader034/viewer/2022052505/554f7818b4c905435d8b4576/html5/thumbnails/10.jpg)
FALSE PROMISES
Thursday, November 29, 12
![Page 11: The only php framework you'll need: Symfony2 - FOWA Prague](https://reader034.vdocuments.us/reader034/viewer/2022052505/554f7818b4c905435d8b4576/html5/thumbnails/11.jpg)
WHAT IS SYMFONY2?
Thursday, November 29, 12
![Page 12: The only php framework you'll need: Symfony2 - FOWA Prague](https://reader034.vdocuments.us/reader034/viewer/2022052505/554f7818b4c905435d8b4576/html5/thumbnails/12.jpg)
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 Potencier
Thursday, November 29, 12
![Page 13: The only php framework you'll need: Symfony2 - FOWA Prague](https://reader034.vdocuments.us/reader034/viewer/2022052505/554f7818b4c905435d8b4576/html5/thumbnails/13.jpg)
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 framework
Thursday, November 29, 12
![Page 14: The only php framework you'll need: Symfony2 - FOWA Prague](https://reader034.vdocuments.us/reader034/viewer/2022052505/554f7818b4c905435d8b4576/html5/thumbnails/14.jpg)
SILEX
require_once __DIR__.'/../vendor/autoload.php';
$app = new Silex\Application();
$app->get('/hello/{name}', function($name) use($app) { return 'Hello '.$app->escape($name); });
$app->run();
Thursday, November 29, 12
![Page 15: The only php framework you'll need: Symfony2 - FOWA Prague](https://reader034.vdocuments.us/reader034/viewer/2022052505/554f7818b4c905435d8b4576/html5/thumbnails/15.jpg)
WHAT SYMFONY2 DOES WELL?
Thursday, November 29, 12
![Page 16: The only php framework you'll need: Symfony2 - FOWA Prague](https://reader034.vdocuments.us/reader034/viewer/2022052505/554f7818b4c905435d8b4576/html5/thumbnails/16.jpg)
WHAT SYMFONY2 DOES WELL?
• Components• Inspired Composer to be created• Silex vs Symfony2 vs your own• Fully working standard distribution• Service container for dependencies
Thursday, November 29, 12
![Page 17: The only php framework you'll need: Symfony2 - FOWA Prague](https://reader034.vdocuments.us/reader034/viewer/2022052505/554f7818b4c905435d8b4576/html5/thumbnails/17.jpg)
STARTING WITH SYMFONY2
Thursday, November 29, 12
![Page 18: The only php framework you'll need: Symfony2 - FOWA Prague](https://reader034.vdocuments.us/reader034/viewer/2022052505/554f7818b4c905435d8b4576/html5/thumbnails/18.jpg)
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.php
Thursday, November 29, 12
![Page 19: The only php framework you'll need: Symfony2 - FOWA Prague](https://reader034.vdocuments.us/reader034/viewer/2022052505/554f7818b4c905435d8b4576/html5/thumbnails/19.jpg)
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 projects
Thursday, November 29, 12
![Page 20: The only php framework you'll need: Symfony2 - FOWA Prague](https://reader034.vdocuments.us/reader034/viewer/2022052505/554f7818b4c905435d8b4576/html5/thumbnails/20.jpg)
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 customize
Thursday, November 29, 12
![Page 21: The only php framework you'll need: Symfony2 - FOWA Prague](https://reader034.vdocuments.us/reader034/viewer/2022052505/554f7818b4c905435d8b4576/html5/thumbnails/21.jpg)
BUNDLES
// src/Acme/DemoBundle/Controller/WelcomeController.php
namespace Acme\DemoBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
class WelcomeController extends Controller{ public function indexAction() { return $this->render('AcmeDemoBundle:Welcome:index.html.twig'); }}
Thursday, November 29, 12
![Page 22: The only php framework you'll need: Symfony2 - FOWA Prague](https://reader034.vdocuments.us/reader034/viewer/2022052505/554f7818b4c905435d8b4576/html5/thumbnails/22.jpg)
SERVICE CONTAINER
// app/config/config.ymlservices: my_mailer: class: Acme\HelloBundle\Mailer arguments: [sendmail]
class WelcomeController extends Controller{ public function sendEmailAction() { $mailer = $this->get('my_mailer'); $mailer->send('[email protected]', ...); }}
Thursday, November 29, 12
![Page 23: The only php framework you'll need: Symfony2 - FOWA Prague](https://reader034.vdocuments.us/reader034/viewer/2022052505/554f7818b4c905435d8b4576/html5/thumbnails/23.jpg)
COMMUNITY
Thursday, November 29, 12
![Page 24: The only php framework you'll need: Symfony2 - FOWA Prague](https://reader034.vdocuments.us/reader034/viewer/2022052505/554f7818b4c905435d8b4576/html5/thumbnails/24.jpg)
COMMUNITY
• Symfony2 on Twitter• Conferences, user groups• All of this?• Good market to be a developer• Less bugs, active GitHub•Drupal
Thursday, November 29, 12
![Page 25: The only php framework you'll need: Symfony2 - FOWA Prague](https://reader034.vdocuments.us/reader034/viewer/2022052505/554f7818b4c905435d8b4576/html5/thumbnails/25.jpg)
QUESTIONS?
Thursday, November 29, 12
![Page 26: The only php framework you'll need: Symfony2 - FOWA Prague](https://reader034.vdocuments.us/reader034/viewer/2022052505/554f7818b4c905435d8b4576/html5/thumbnails/26.jpg)
THANKS!
Juozas Kaziukėnashttp://juokaz.com/@juokaz
Thursday, November 29, 12