The only php framework you'll need: Symfony2 - FOWA Prague
Upcoming SlideShare
Loading in...5
×
 

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

on

  • 3,980 views

 

Statistics

Views

Total Views
3,980
Views on SlideShare
3,980
Embed Views
0

Actions

Likes
3
Downloads
44
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

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

  • THE ONLY PHP FRAMEWORK YOULL NEED: SYMFONY2 Juozas Kaziukėnas // juokaz.com // @juokazThursday, November 29, 12
  • Juozas Kaziukėnas, Lithuanian You can call me Joe Talk to me at @juokaz More info http://juokaz.comThursday, November 29, 12
  • 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 practices • Standardization • Decoupling • etc.Thursday, November 29, 12
  • 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 • Low quality • Slow • million other reasonsThursday, November 29, 12
  • 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 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
  • 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
  • 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
  • WHAT SYMFONY2 DOES WELL?Thursday, November 29, 12
  • 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
  • STARTING WITH SYMFONY2Thursday, November 29, 12
  • 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
  • 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
  • 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
  • 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
  • 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
  • COMMUNITYThursday, November 29, 12
  • COMMUNITY • Symfony2 on Twitter • Conferences, user groups • All of this? • Good market to be a developer • Less bugs, active GitHub • DrupalThursday, November 29, 12
  • QUESTIONS?Thursday, November 29, 12
  • THANKS! Juozas Kaziukėnas http://juokaz.com/ @juokazThursday, November 29, 12