A Practical Introduction to Symfony2

download A Practical Introduction to Symfony2

of 158

  • date post

    15-Apr-2017
  • Category

    Technology

  • view

    12.127
  • download

    1

Embed Size (px)

Transcript of A Practical Introduction to Symfony2

  • A Practical Introductionto Symfony2

    Kris Wallsmith

    PHP Matsuri October 2, 2010

    Saturday, October 2, 2010

  • @kriswallsmith

    Release Manager for symfony 1.3 & 1.4 Doctrine contributor Senior Software Engineer at 10 years experience in web development Open source evangelist and international speaker

    Saturday, October 2, 2010

  • the evolution of symfony

    Mojavi 3 symfony (2007) Symfony2 (2011)

    Saturday, October 2, 2010

  • a quick note for thecase-sensitive among us

    Saturday, October 2, 2010

  • talk about symfony

    Saturday, October 2, 2010

  • talk about symfony 1

    Saturday, October 2, 2010

  • talk about Symfony2

    Saturday, October 2, 2010

  • there is no Symfony 1

    Saturday, October 2, 2010

  • there is no symfony 2

    Saturday, October 2, 2010

  • there is no Symfony 2

    Saturday, October 2, 2010

  • there is no Symfony 2

    less search-friendly

    {Saturday, October 2, 2010

  • Symfony2

    Saturday, October 2, 2010

  • Symfony2#

    Saturday, October 2, 2010

  • the evolution of symfony

    Mojavi 3 symfony (2007) Symfony2 (2011)

    Saturday, October 2, 2010

  • whats old?

    Saturday, October 2, 2010

  • whats old?

    same philosophy as symfony 1

    Saturday, October 2, 2010

  • whats old?

    same philosophy as symfony 1 dont reinvent the wheel

    Saturday, October 2, 2010

  • whats old?

    same philosophy as symfony 1 dont reinvent the wheel loosely-coupled components

    Saturday, October 2, 2010

  • whats old?

    same philosophy as symfony 1 dont reinvent the wheel loosely-coupled components predictable conventions

    Saturday, October 2, 2010

  • whats old?

    same philosophy as symfony 1 dont reinvent the wheel loosely-coupled components predictable conventions highly configurable

    Saturday, October 2, 2010

  • whats old?

    same philosophy as symfony 1 dont reinvent the wheel loosely-coupled components predictable conventions highly configurable testable

    Saturday, October 2, 2010

  • whats old?

    same philosophy as symfony 1 dont reinvent the wheel loosely-coupled components predictable conventions highly configurable testable awesome developer tools

    Saturday, October 2, 2010

  • whats new?

    Saturday, October 2, 2010

  • whats new?

    PHP 5.3 a brand new foundation

    Saturday, October 2, 2010

  • whats new?

    PHP 5.3 a brand new foundation more smart, more lazy

    Saturday, October 2, 2010

  • whats new?

    PHP 5.3 a brand new foundation more smart, more lazy REALLY REALLY FAST

    Saturday, October 2, 2010

  • whats new?

    PHP 5.3 a brand new foundation more smart, more lazy REALLY REALLY FAST

    Saturday, October 2, 2010

  • PHP 5.3

    Saturday, October 2, 2010

  • PHP 5.3

    namespaces closures

    Saturday, October 2, 2010

  • Saturday, October 2, 2010

  • HTTP\Message\Request

    Saturday, October 2, 2010

  • HTTP\Message\Request

    Saturday, October 2, 2010

  • Saturday, October 2, 2010

  • Saturday, October 2, 2010

  • Saturday, October 2, 2010

  • HTTP\Client\Request

    Saturday, October 2, 2010

  • HTTP\Client\Request

    Saturday, October 2, 2010

  • Saturday, October 2, 2010

  • Saturday, October 2, 2010

  • Saturday, October 2, 2010

  • Saturday, October 2, 2010

  • Saturday, October 2, 2010

  • Saturday, October 2, 2010

  • Saturday, October 2, 2010

  • closures

    anonymous functions lambda functions

    Saturday, October 2, 2010

  • Saturday, October 2, 2010

  • Saturday, October 2, 2010

  • Saturday, October 2, 2010

  • Saturday, October 2, 2010

  • Saturday, October 2, 2010

  • a new foundation

    Saturday, October 2, 2010

  • anatomy of a Symfony2 request

    Saturday, October 2, 2010

  • anatomy of a Symfony2 request

    Kernel

    Saturday, October 2, 2010

  • anatomy of a Symfony2 request

    Kernel Request

    Saturday, October 2, 2010

  • anatomy of a Symfony2 request

    Kernel Request Controller

    Saturday, October 2, 2010

  • anatomy of a Symfony2 request

    Kernel Request Controller Response

    Saturday, October 2, 2010

  • anatomy of a Symfony2 request

    Saturday, October 2, 2010

  • anatomy of a Symfony2 request

    index.php creates a Kernel

    Saturday, October 2, 2010

  • anatomy of a Symfony2 request

    index.php creates a Kernel the kernel creates a Request

    Saturday, October 2, 2010

  • anatomy of a Symfony2 request

    index.php creates a Kernel the kernel creates a Request the kernel passes the Request to the ControllerResolver

    Saturday, October 2, 2010

  • anatomy of a Symfony2 request

    index.php creates a Kernel the kernel creates a Request the kernel passes the Request to the ControllerResolver the ControllerResolver returns a callable

    Saturday, October 2, 2010

  • anatomy of a Symfony2 request

    index.php creates a Kernel the kernel creates a Request the kernel passes the Request to the ControllerResolver the ControllerResolver returns a callable the kernel calls the callable

    Saturday, October 2, 2010

  • anatomy of a Symfony2 request

    index.php creates a Kernel the kernel creates a Request the kernel passes the Request to the ControllerResolver the ControllerResolver returns a callable the kernel calls the callable the callable returns a Response

    Saturday, October 2, 2010

  • Silexhttp://github.com/fabpot/Silex

    Saturday, October 2, 2010

  • just enough, nothing more

    Saturday, October 2, 2010

  • Saturday, October 2, 2010

  • switch ($_GET['pg'])case 'edit':// ...

    Saturday, October 2, 2010

  • switch ($_GET['pg'])case 'edit':// ...

    Saturday, October 2, 2010

  • Any volunteers to rewrite WordPress in Silex?

    Saturday, October 2, 2010

  • quick tour

    Saturday, October 2, 2010

  • frontend/src/web/

    Saturday, October 2, 2010

  • frontend/ FrontendKernel.php cache/ config/ console logs/ phpunit.xml

    Saturday, October 2, 2010

  • src/ autoload.php Application/ Bundle/ vendor/ symfony/ doctrine/

    Saturday, October 2, 2010

  • web/ css/ images/ index.php index_dev.php js/

    Saturday, October 2, 2010

  • ../ MainBundle/ Controller/ MainBundle.php Resources/ config/ views/ Tests/

    Saturday, October 2, 2010

  • How do I use it?

    Saturday, October 2, 2010

  • # frontend/config/routing.ymlhomepage: pattern: / defaults: _controller: MainBundle:Main:index requirements: _method: get

    Saturday, October 2, 2010

  • // src/Application/MainBundle/Controller/MainController.phpnamespace Application\MainBundle\Controller;

    class MainController extends Controller{ public function indexAction() { return $this->render('MainBundle:Main:index.php'); }}

    Saturday, October 2, 2010

  • namespace Application\MainBundle\Controller;

    class MainController extends Controller{ public function indexAction() { return $this->render('MainBundle:Main:index.php'); }}

    homepage: pattern: / defaults: _controller: MainBundle:Main:index requirements: _method: get

    Saturday, October 2, 2010

  • namespace Application\MainBundle\Controller;

    class MainController extends Controller{ public function indexAction() { return $this->render('MainBundle:Main:index.php'); }}

    homepage: pattern: / defaults: _controller: MainBundle:Main:index requirements: _method: get

    Saturday, October 2, 2010

  • namespace Application\MainBundle\Controller;

    class MainController extends Controller{ public function indexAction() { return $this->render('MainBundle:Main:index.php'); }}

    homepage: pattern: / defaults: _controller: MainBundle:Main:index requirements: _method: get

    Saturday, October 2, 2010

  • namespace Application\MainBundle\Controller;

    class MainController extends Controller{ public function indexAction() { return $this->render('MainBundle:Main:index.php'); }}

    homepage: pattern: / defaults: _controller: MainBundle:Main:index requirements: _method: get

    Saturday, October 2, 2010

  • namespace Application\MainBundle\Controller;

    class MainController extends Controller{ public function indexAction() { return $this->render('MainBundle:Main:index.php'); }}

    homepage: pattern: / defaults: _controller: MainBundle:Main:index requirements: _method: get

    Saturday, October 2, 2010

  • namespace Application\MainBundle\Controller;

    class MainController extends Controller{ public function indexAction() { return $this->render('MainBundle:Main:index.php'); }}

    homepage: pattern: / defaults: _controller: MainBundle:Main:index requirements: _method: get

    Saturday, October 2, 2010

  • namespace Application\MainBundle\Controller;

    class BlogController extends Controller { public function showArticleAction($slug, $year) { // ... return $this->render('MainBundle:Blog:sho