by yosvel

Slides
177 slides

Symfony 2, un framework robuste et moderne

Published Jan 16, 2013 in Education
Direct Link :

Symfony 2, un framework robuste et moderne... Read more

Présentation du framework PHP 5 Symfony 2

Read less


Comments

comments powered by Disqus

Presentation Slides & Transcript

Presentation Slides & Transcript

Un framework PHP robuste et moderne Geoffrey Bachelet Ð Pandanova mercredi 5 septembre 12

HTTP MVC INJECTION DE DƒPENDANCE COMPOSANTS BUNDLES CONTRïLE QUALITƒ mercredi 5 septembre 12

HTTP mercredi 5 septembre 12

HTTP Quel est le cycle de vie dÕune page web ? mercredi 5 septembre 12

Requte RŽponse HTTP mercredi 5 septembre 12

Requte RŽponse Application HTTP mercredi 5 septembre 12

Requte RŽponse Application GET HTTP mercredi 5 septembre 12

Requte RŽponse Application GET POST HTTP mercredi 5 septembre 12

Requte RŽponse Application GET POST PUT HTTP mercredi 5 septembre 12

Requte RŽponse Application GET POST PUT DELETE HTTP mercredi 5 septembre 12

Requte RŽponse Application GET POST PUT DELETE ... HTTP mercredi 5 septembre 12

Requte RŽponse Application GET POST PUT DELETE ... HTML HTTP mercredi 5 septembre 12

Requte RŽponse Application GET POST PUT DELETE ... HTML XML HTTP mercredi 5 septembre 12

Requte RŽponse Application GET POST PUT DELETE ... HTML XML JSON HTTP mercredi 5 septembre 12

Requte RŽponse Application GET POST PUT DELETE ... HTML XML JSON ... HTTP mercredi 5 septembre 12

Tirer parti du protocole HTTP HTTP mercredi 5 septembre 12

Codes dՎtat (200, 404, ...) Tirer parti du protocole HTTP HTTP mercredi 5 septembre 12

Codes dՎtat (200, 404, ...) Redirections Tirer parti du protocole HTTP HTTP mercredi 5 septembre 12

Codes dՎtat (200, 404, ...) Redirections Verbes (GET, POST, ...) Tirer parti du protocole HTTP HTTP mercredi 5 septembre 12

Codes dՎtat (200, 404, ...) Redirections Verbes (GET, POST, ...) Cache (etags, validation, ...) Tirer parti du protocole HTTP HTTP mercredi 5 septembre 12

Codes dՎtat (200, 404, ...) Redirections Verbes (GET, POST, ...) Cache (etags, validation, ...) NŽgociation de contenu Tirer parti du protocole HTTP HTTP mercredi 5 septembre 12

Codes dՎtat (200, 404, ...) Redirections Verbes (GET, POST, ...) Cache (etags, validation, ...) NŽgociation de contenu ... Tirer parti du protocole HTTP HTTP mercredi 5 septembre 12

Documentation : http://symfony.com/doc/current/book/http_fundamentals.html Composant : http://symfony.com/doc/current/components/http_foundation/ introduction.html HTTP mercredi 5 septembre 12

MVC mercredi 5 septembre 12

MVC mercredi 5 septembre 12

La couche modle MVC mercredi 5 septembre 12

title , 0 , 15 ); !!!! } } http://doctrine-project.org / MVC mercredi 5 septembre 12

title , 0 , 15 ); !!!! } } http://doctrine-project.org / MVC DonnŽes mercredi 5 septembre 12

title , 0 , 15 ); !!!! } } http://doctrine-project.org / MVC MŽtier mercredi 5 septembre 12

!!!!

!!!!!!!! !!!!!!!! !!!!!!!! !!!!
http://propelorm.org/ MVC mercredi 5 septembre 12

!!!!

!!!!!!!! !!!!!!!! !!!!!!!! !!!!
http://propelorm.org/ MVC DonnŽes mercredi 5 septembre 12

title , 0 , 15 ); !!!! } } http://propelorm.org/ MVC mercredi 5 septembre 12

title , 0 , 15 ); !!!! } } http://propelorm.org/ MVC MŽtier mercredi 5 septembre 12

La couche vue MVC mercredi 5 septembre 12

{% extends 'layout.html.twig' %} {% for post in posts %}

!!!!

{{ post.title }}

!!!!
!!!!!!!! {{ post.body | markdown }} !!!!
{% endfor %} Twig http://twig.sensiolabs.org / MVC mercredi 5 septembre 12

{% extends 'layout.html.twig' %} {% for post in posts %}

!!!!

{{ post.title }}

!!!!
!!!!!!!! {{ post.body | markdown }} !!!!
{% endfor %} http://twig.sensiolabs.org / MVC Layout mercredi 5 septembre 12

{% extends 'layout.html.twig' %} {% for post in posts %}

!!!!

{{ post.title }}

!!!!
!!!!!!!! {{ post.body | markdown }} !!!!
{% endfor %} http://twig.sensiolabs.org / MVC Boucles mercredi 5 septembre 12

{% extends 'layout.html.twig' %} {% for post in posts %}

!!!!

{{ post.title }}

!!!!
!!!!!!!! {{ post.body | markdown }} !!!!
{% endfor %} http://twig.sensiolabs.org / MVC Variables mercredi 5 septembre 12

{% extends 'layout.html.twig' %} {% for post in posts %}

!!!!

{{ post.title }}

!!!!
!!!!!!!! {{ post.body | markdown }} !!!!
{% endfor %} http://twig.sensiolabs.org / MVC Filtres mercredi 5 septembre 12

Le contr™leur MVC mercredi 5 septembre 12

render ( 'MyBundle:Post:list' , array ( !!!!!!!!!!!! 'posts' => PostQuery :: create () -> find () !!!!!!!! )); !!!! } } MVC mercredi 5 septembre 12

render ( 'MyBundle:Post:list' , array ( !!!!!!!!!!!! 'posts' => PostQuery :: create () -> find () !!!!!!!! )); !!!! } } MVC Template mercredi 5 septembre 12

render ( 'MyBundle:Post:list' , array ( !!!!!!!!!!!! 'posts' => PostQuery :: create () -> find () !!!!!!!! )); !!!! } } MVC DonnŽes mercredi 5 septembre 12

Logique mŽtier encapsulŽe Facilement testable Facilement maintenable MVC mercredi 5 septembre 12

INJECTION DE DƒPENDANCE mercredi 5 septembre 12

class User { !!!! public function __construct () !!!! { !!!!!!!! $this -> storage = new SessionStorage( 'SESSION_ID' ); !!!! } !!!! public function setLanguage ( $language ) !!!! { !!!!!!!! $this -> storage -> set ( 'language' , $language ); !!!! } } $user = new User(); INJECTION DE DƒPENDANCE mercredi 5 septembre 12

class User { !!!! public function __construct () !!!! { !!!!!!!! $this -> storage = new SessionStorage( 'SESSION_ID' ); !!!! } !!!! public function setLanguage ( $language ) !!!! { !!!!!!!! $this -> storage -> set ( 'language' , $language ); !!!! } } $user = new User(); INJECTION DE DƒPENDANCE DŽpendance forte mercredi 5 septembre 12

class User { !!!! private $storage ; !!!! public function __construct (StorageInterface $storage ) !!!! { !!!!!!!! $this -> storage = $storage ; !!!! } } $storage = new SessionStorage( 'SESSION_ID' ); $user = new User( $storage ); INJECTION DE DƒPENDANCE Injection mercredi 5 septembre 12

class User { !!!! private $storage ; !!!! public function __construct (StorageInterface $storage ) !!!! { !!!!!!!! $this -> storage = $storage ; !!!! } } $storage = new SessionStorage( 'my_session_name' ); $user = new User( $storage ); INJECTION DE DƒPENDANCE mercredi 5 septembre 12

class User { !!!! private $storage ; !!!! public function __construct (StorageInterface $storage ) !!!! { !!!!!!!! $this -> storage = $storage ; !!!! } } $storage = new MemcacheStorage(); $user = new User( $storage ); INJECTION DE DƒPENDANCE mercredi 5 septembre 12

class User { !!!! private $storage ; !!!! public function __construct (StorageInterface $storage ) !!!! { !!!!!!!! $this -> storage = $storage ; !!!! } } $storage = new MemcacheStorage($memcacheClient); $user = new User( $storage ); INJECTION DE DƒPENDANCE mercredi 5 septembre 12

http://www.slideshare.net/fabpot/dependency-injection-in-php-5354 Flexible Configurable DŽcouplŽ INJECTION DE DƒPENDANCE mercredi 5 septembre 12

COMPOSANTS mercredi 5 septembre 12

COMPOSANTS ClassLoader Config Console DependencyInjection EventDispatcher Finder Form HttpFoundation Locale Process Routing Security Templating Validation YAML ... mercredi 5 septembre 12

CLASSLOADER mercredi 5 septembre 12

CLASSLOADER ÒAutoloadingÓ respectant le standard PSR-0 https://github.com/php-fig/fig-standards/blob/master/accepted/ PSR-0.md COMPOSANTS mercredi 5 septembre 12

CLASSLOADER registerNamespaces ( array ( !!!! 'Symfony' => __DIR__ . '/../vendor/symfony/src' , !!!! 'Monolog' => __DIR__ . '/../vendor/monolog/src' , )); $loader -> registerPrefixes ( array ( !!!! 'Swift_' => __DIR__ . '/vendor/swiftmailer/lib/classes' , !!!! 'Twig_' => __DIR__ . '/vendor/twig/lib' , )); $loader -> register (); COMPOSANTS mercredi 5 septembre 12

CLASSLOADER registerNamespaces ( array ( !!!! 'Symfony' => __DIR__ . '/../vendor/symfony/src' , !!!! 'Monolog' => __DIR__ . '/../vendor/monolog/src' , )); $loader -> registerPrefixes ( array ( !!!! 'Swift_' => __DIR__ . '/vendor/swiftmailer/lib/classes' , !!!! 'Twig_' => __DIR__ . '/vendor/twig/lib' , )); $loader -> register (); COMPOSANTS Namespaces mercredi 5 septembre 12

CLASSLOADER registerNamespaces ( array ( !!!! 'Symfony' => __DIR__ . '/../vendor/symfony/src' , !!!! 'Monolog' => __DIR__ . '/../vendor/monolog/src' , )); $loader -> registerPrefixes ( array ( !!!! 'Swift_' => __DIR__ . '/vendor/swiftmailer/lib/classes' , !!!! 'Twig_' => __DIR__ . '/vendor/twig/lib' , )); $loader -> register (); COMPOSANTS PrŽfixes mercredi 5 septembre 12

CONFIG mercredi 5 septembre 12

CONFIG Gestion avancŽe de configuration COMPOSANTS mercredi 5 septembre 12

CONFIG Gestion avancŽe de configuration Chargement de fichiers de configuration COMPOSANTS mercredi 5 septembre 12

CONFIG Gestion avancŽe de configuration Chargement de fichiers de configuration Mise en cache de la configuration COMPOSANTS mercredi 5 septembre 12

CONFIG Gestion avancŽe de configuration Chargement de fichiers de configuration Mise en cache de la configuration DŽfinition du format de configuration COMPOSANTS mercredi 5 septembre 12

CONFIG Gestion avancŽe de configuration Chargement de fichiers de configuration Mise en cache de la configuration DŽfinition du format de configuration Multi-source (fichiers, base de donnŽes) COMPOSANTS mercredi 5 septembre 12

CONFIG Gestion avancŽe de configuration Chargement de fichiers de configuration Mise en cache de la configuration DŽfinition du format de configuration Multi-source (fichiers, base de donnŽes) Multi-format (YAML, XML, JSON) COMPOSANTS mercredi 5 septembre 12

CONSOLE mercredi 5 septembre 12

CONSOLE COMPOSANTS mercredi 5 septembre 12

CONSOLE COMPOSANTS mercredi 5 septembre 12

CONSOLE options COMPOSANTS mercredi 5 septembre 12

CONSOLE options argument COMPOSANTS mercredi 5 septembre 12

CONSOLE options argument valeur par dŽfaut COMPOSANTS mercredi 5 septembre 12

DEPENDENCYINJECTION mercredi 5 septembre 12

DEPENDENCYINJECTION parameters: !!!! mailer.transport: sendmail services: !!!! mailer: !!!!!!!! class: Mailer !!!!!!!! arguments: [ % mailer.transport% ] !!!! newsletter_manager: !!!!!!!! class: NewsletterManager !!!!!!!! calls: !!!!!!!!!!!! - [ setMailer , [ @ mailer ] ] COMPOSANTS mercredi 5 septembre 12

DEPENDENCYINJECTION parameters: !!!! mailer.transport: sendmail services: !!!! mailer: !!!!!!!! class: Mailer !!!!!!!! arguments: [ % mailer.transport% ] !!!! newsletter_manager: !!!!!!!! class: NewsletterManager !!!!!!!! calls: !!!!!!!!!!!! - [ setMailer , [ @ mailer ] ] COMPOSANTS mercredi 5 septembre 12

DEPENDENCYINJECTION parameters: !!!! mailer.transport: sendmail services: !!!! mailer: !!!!!!!! class: Mailer !!!!!!!! arguments: [ % mailer.transport% ] !!!! newsletter_manager: !!!!!!!! class: NewsletterManager !!!!!!!! calls: !!!!!!!!!!!! - [ setMailer , [ @ mailer ] ] COMPOSANTS Paramtre mercredi 5 septembre 12

DEPENDENCYINJECTION parameters: !!!! mailer.transport: sendmail services: !!!! mailer: !!!!!!!! class: Mailer !!!!!!!! arguments: [ % mailer.transport% ] !!!! newsletter_manager: !!!!!!!! class: NewsletterManager !!!!!!!! calls: !!!!!!!!!!!! - [ setMailer , [ @ mailer ] ] COMPOSANTS Service mercredi 5 septembre 12

DEPENDENCYINJECTION use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\Config\FileLocator; use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; $container = new ContainerBuilder(); $loader = new YamlFileLoader( $container , new FileLocator(__DIR__)); $loader -> load ( 'services.yml' ); $manager = $container -> get ( 'newsletter_manager' ); COMPOSANTS mercredi 5 septembre 12

DEPENDENCYINJECTION use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\Config\FileLocator; use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; $container = new ContainerBuilder(); $loader = new YamlFileLoader( $container , new FileLocator(__DIR__)); $loader -> load ( 'services.yml' ); $manager = $container -> get ( 'newsletter_manager' ); COMPOSANTS mercredi 5 septembre 12

EVENTDISPATCHER mercredi 5 septembre 12

EVENTDISPATCHER ImplŽmentation du design pattern ÒObserverÓ COMPOSANTS mercredi 5 septembre 12

EVENTDISPATCHER use Symfony\Component\EventDispatcher\EventDispatcher; use Symfony\Component\EventDispatcher\Event; $dispatcher = new EventDispatcher(); $dispatcher -> addListener ( 'foo.action' , function (Event $event ) { !!!! // will be executed when the foo.action event is dispatched }); $dispatcher -> dispatch ( 'foo.action' , new Event()); COMPOSANTS mercredi 5 septembre 12

EVENTDISPATCHER use Symfony\Component\EventDispatcher\EventDispatcher; use Symfony\Component\EventDispatcher\Event; $dispatcher = new EventDispatcher(); $dispatcher -> addListener ( 'foo.action' , function (Event $event ) { !!!! // will be executed when the foo.action event is dispatched }); $dispatcher -> dispatch ( 'foo.action' , new Event()); COMPOSANTS mercredi 5 septembre 12

EVENTDISPATCHER use Symfony\Component\EventDispatcher\EventDispatcher; use Symfony\Component\EventDispatcher\Event; $dispatcher = new EventDispatcher(); $dispatcher -> addListener ( 'foo.action' , function (Event $event ) { !!!! // will be executed when the foo.action event is dispatched }); $dispatcher -> dispatch ( 'foo.action' , new Event()); COMPOSANTS Listener mercredi 5 septembre 12

EVENTDISPATCHER use Symfony\Component\EventDispatcher\EventDispatcher; use Symfony\Component\EventDispatcher\Event; $dispatcher = new EventDispatcher(); $dispatcher -> addListener ( 'foo.action' , function (Event $event ) { !!!! // will be executed when the foo.action event is dispatched }); $dispatcher -> dispatch ( 'foo.action' , new Event()); COMPOSANTS ƒvŽnement mercredi 5 septembre 12

FINDER mercredi 5 septembre 12

FINDER use Symfony\Component\Finder\Finder; $finder = new Finder(); $finder -> files () -> in (__DIR__); foreach ( $finder as $file ) { !!!! // Print the absolute path !!!! print $file -> getRealpath () . "\n" ; !!!! // Print the relative path to the file, omitting the filename !!!! print $file -> getRelativePath () . "\n" ; !!!! // Print the relative path to the file !!!! print $file -> getRelativePathname () . "\n" ; } COMPOSANTS mercredi 5 septembre 12

FINDER use Symfony\Component\Finder\Finder; $finder = new Finder(); $finder -> files () -> in (__DIR__); foreach ( $finder as $file ) { !!!! // Print the absolute path !!!! print $file -> getRealpath () . "\n" ; !!!! // Print the relative path to the file, omitting the filename !!!! print $file -> getRelativePath () . "\n" ; !!!! // Print the relative path to the file !!!! print $file -> getRelativePathname () . "\n" ; } SplFileInfo COMPOSANTS mercredi 5 septembre 12

FINDER use Symfony\Component\Finder\Finder; $finder = new Finder(); $finder -> files () -> in (__DIR__); foreach ( $finder as $file ) { !!!! // Print the absolute path !!!! print $file -> getRealpath () . "\n" ; !!!! // Print the relative path to the file, omitting the filename !!!! print $file -> getRelativePath () . "\n" ; !!!! // Print the relative path to the file !!!! print $file -> getRelativePathname () . "\n" ; } COMPOSANTS mercredi 5 septembre 12

FINDER use Symfony\Component\Finder\Finder; $finder = new Finder(); $finder -> files () -> in (__DIR__); foreach ( $finder as $file ) { !!!! // Print the absolute path !!!! print $file -> getRealpath () . "\n" ; !!!! // Print the relative path to the file, omitting the filename !!!! print $file -> getRelativePath () . "\n" ; !!!! // Print the relative path to the file !!!! print $file -> getRelativePathname () . "\n" ; } COMPOSANTS mercredi 5 septembre 12

FINDER use Symfony\Component\Finder\Finder; $finder = new Finder(); $finder -> files () -> in (__DIR__); foreach ( $finder as $file ) { !!!! // Print the absolute path !!!! print $file -> getRealpath () . "\n" ; !!!! // Print the relative path to the file, omitting the filename !!!! print $file -> getRelativePath () . "\n" ; !!!! // Print the relative path to the file !!!! print $file -> getRelativePathname () . "\n" ; } COMPOSANTS mercredi 5 septembre 12

FINDER Recherche dans plusieurs rŽpertoires COMPOSANTS mercredi 5 septembre 12

FINDER Recherche dans plusieurs rŽpertoires Exclusion de rŽpertoire COMPOSANTS mercredi 5 septembre 12

FINDER Recherche dans plusieurs rŽpertoires Exclusion de rŽpertoire Recherche sur masques de fichiers COMPOSANTS mercredi 5 septembre 12

FINDER Recherche dans plusieurs rŽpertoires Exclusion de rŽpertoire Recherche sur masques de fichiers Recherche par taille COMPOSANTS mercredi 5 septembre 12

FINDER Recherche dans plusieurs rŽpertoires Exclusion de rŽpertoire Recherche sur masques de fichiers Recherche par taille Recherche par date COMPOSANTS mercredi 5 septembre 12

FINDER Recherche dans plusieurs rŽpertoires Exclusion de rŽpertoire Recherche sur masques de fichiers Recherche par taille Recherche par date Tri standard (nom, type) COMPOSANTS mercredi 5 septembre 12

FINDER Recherche dans plusieurs rŽpertoires Exclusion de rŽpertoire Recherche sur masques de fichiers Recherche par taille Recherche par date Tri standard (nom, type) Tri personnalisŽ (ÒcallbackÓ) COMPOSANTS mercredi 5 septembre 12

FINDER Recherche dans plusieurs rŽpertoires Exclusion de rŽpertoire Recherche sur masques de fichiers Recherche par taille Recherche par date Tri standard (nom, type) Tri personnalisŽ (ÒcallbackÓ) Compatible avec les ÒstreamsÓ PHP COMPOSANTS mercredi 5 septembre 12

FINDER Recherche dans plusieurs rŽpertoires Exclusion de rŽpertoire Recherche sur masques de fichiers Recherche par taille Recherche par date Tri standard (nom, type) Tri personnalisŽ (ÒcallbackÓ) Compatible avec les ÒstreamsÓ PHP ... COMPOSANTS mercredi 5 septembre 12

FORM mercredi 5 septembre 12

FORM Gestion de formulaires complexes COMPOSANTS mercredi 5 septembre 12

FORM Gestion de formulaires complexes Rendu personnalisable via Twig COMPOSANTS mercredi 5 septembre 12

FORM Gestion de formulaires complexes Rendu personnalisable via Twig Validation des donnŽes COMPOSANTS mercredi 5 septembre 12

FORM Gestion de formulaires complexes Rendu personnalisable via Twig Validation des donnŽes Encore en beta (prŽvu pour la 2.1) COMPOSANTS mercredi 5 septembre 12

COMPOSANTS ClassLoader Config Console DependencyInjection EventDispatcher Finder Form HttpFoundation Locale Process Routing Security Templating Validation YAML ... mercredi 5 septembre 12

ÒIl y a un composant pour aÓ http://symfony.com/doc/current/components/index.html COMPOSANTS mercredi 5 septembre 12

BUNDLES mercredi 5 septembre 12

BUNDLES ÒTout est Bundle !Ó mercredi 5 septembre 12

BUNDLES mercredi 5 septembre 12

BUNDLES Bundle mercredi 5 septembre 12

BUNDLES Bundle mercredi 5 septembre 12

BUNDLES Bundle mercredi 5 septembre 12

BUNDLES Bundle mercredi 5 septembre 12

Un Bundle peut contenir : BUNDLES mercredi 5 septembre 12

Un Bundle peut contenir : Des extensions pour lÕinjection de dŽpendance BUNDLES mercredi 5 septembre 12

Un Bundle peut contenir : Des extensions pour lÕinjection de dŽpendance Des contr™leurs BUNDLES mercredi 5 septembre 12

Un Bundle peut contenir : Des extensions pour lÕinjection de dŽpendance Des contr™leurs Des gabarits Twig BUNDLES mercredi 5 septembre 12

Un Bundle peut contenir : Des extensions pour lÕinjection de dŽpendance Des contr™leurs Des gabarits Twig La couche modle BUNDLES mercredi 5 septembre 12

Un Bundle peut contenir : Des extensions pour lÕinjection de dŽpendance Des contr™leurs Des gabarits Twig La couche modle Tout le nŽcessaire pour votre application BUNDLES mercredi 5 septembre 12

Un moyen efficace de structurer du code BUNDLES mercredi 5 septembre 12

Un moyen efficace de partager du code BUNDLES mercredi 5 septembre 12

BUNDLES mercredi 5 septembre 12

BUNDLES 1611 Bundles ! mercredi 5 septembre 12

Assetic Bundle BUNDLES mercredi 5 septembre 12

Assetic Bundle AvalancheImagine Bundle BUNDLES mercredi 5 septembre 12

Assetic Bundle AvalancheImagine Bundle FOSComment Bundle BUNDLES mercredi 5 septembre 12

Assetic Bundle AvalancheImagine Bundle FOSComment Bundle FOSRest Bundle BUNDLES mercredi 5 septembre 12

Assetic Bundle AvalancheImagine Bundle FOSComment Bundle FOSRest Bundle FOSUser Bundle BUNDLES mercredi 5 septembre 12

Assetic Bundle AvalancheImagine Bundle FOSComment Bundle FOSRest Bundle FOSUser Bundle Gravatar Bundle BUNDLES mercredi 5 septembre 12

Assetic Bundle AvalancheImagine Bundle FOSComment Bundle FOSRest Bundle FOSUser Bundle Gravatar Bundle HWIOAuth Bundle BUNDLES mercredi 5 septembre 12

Assetic Bundle AvalancheImagine Bundle FOSComment Bundle FOSRest Bundle FOSUser Bundle Gravatar Bundle HWIOAuth Bundle KnpMenu Bundle BUNDLES mercredi 5 septembre 12

Assetic Bundle AvalancheImagine Bundle FOSComment Bundle FOSRest Bundle FOSUser Bundle Gravatar Bundle HWIOAuth Bundle KnpMenu Bundle KnpRad Bundle BUNDLES mercredi 5 septembre 12

Assetic Bundle AvalancheImagine Bundle FOSComment Bundle FOSRest Bundle FOSUser Bundle Gravatar Bundle HWIOAuth Bundle KnpMenu Bundle KnpRad Bundle RabbitMq Bundle BUNDLES mercredi 5 septembre 12

Assetic Bundle AvalancheImagine Bundle FOSComment Bundle FOSRest Bundle FOSUser Bundle Gravatar Bundle HWIOAuth Bundle KnpMenu Bundle KnpRad Bundle RabbitMq Bundle ... BUNDLES mercredi 5 septembre 12

ÒIl y a un Bundle pour a !Ó http://knpbundles.com/ BUNDLES mercredi 5 septembre 12

CONTRïLE QUALITƒ mercredi 5 septembre 12

CONTRïLE QUALITƒ mercredi 5 septembre 12

// src/Acme/DemoBundle/Tests/Utility/CalculatorTest.php namespace Acme\DemoBundle\Tests\Utility; use Acme\DemoBundle\Utility\Calculator; class CalculatorTest extends \PHPUnit_Framework_TestCase { !!!! public function testAdd () !!!! { !!!!!!!! $calc = new Calculator(); !!!!!!!! $result = $calc -> add ( 30 , 12 ); !!!!!!!! // assert that our calculator added the numbers correctly! !!!!!!!! $this -> assertEquals ( 42 , $result ); !!!! } } CONTRïLE QUALITƒ mercredi 5 septembre 12

CONTRïLE QUALITƒ Barre verte ! mercredi 5 septembre 12

CONTRïLE QUALITƒ Seulement une partie des tests mercredi 5 septembre 12

http://phpunit.de / CONTRïLE QUALITƒ mercredi 5 septembre 12

Tests fonctionnels CONTRïLE QUALITƒ mercredi 5 septembre 12

// src/Acme/DemoBundle/Tests/Controller/DemoControllerTest.php namespace Acme\DemoBundle\Tests\Controller; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; class DemoControllerTest extends WebTestCase { !!!! public function testIndex () !!!! { !!!!!!!! $client = static:: createClient (); !!!!!!!! $crawler = $client -> request ( 'GET' , '/demo/hello/Fabien' ); !!!!!!!! $count = $crawler -> filter ( 'html:contains("Hello Fabien")' ) -> count (); !!!!!!!! $this -> assertGreaterThan ( 0 , $count ); !!!! } } CONTRïLE QUALITƒ mercredi 5 septembre 12

// src/Acme/DemoBundle/Tests/Controller/DemoControllerTest.php namespace Acme\DemoBundle\Tests\Controller; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; class DemoControllerTest extends WebTestCase { !!!! public function testIndex () !!!! { !!!!!!!! $client = static:: createClient (); !!!!!!!! $crawler = $client -> request ( 'GET' , '/demo/hello/Fabien' ); !!!!!!!! $count = $crawler -> filter ( 'html:contains("Hello Fabien")' ) -> count (); !!!!!!!! $this -> assertGreaterThan ( 0 , $count ); !!!! } } CONTRïLE QUALITƒ Navigateur mercredi 5 septembre 12

// src/Acme/DemoBundle/Tests/Controller/DemoControllerTest.php namespace Acme\DemoBundle\Tests\Controller; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; class DemoControllerTest extends WebTestCase { !!!! public function testIndex () !!!! { !!!!!!!! $client = static:: createClient (); !!!!!!!! $crawler = $client -> request ( 'GET' , '/demo/hello/Fabien' ); !!!!!!!! $count = $crawler -> filter ( 'html:contains("Hello Fabien")' ) -> count (); !!!!!!!! $this -> assertGreaterThan ( 0 , $count ); !!!! } } CONTRïLE QUALITƒ mercredi 5 septembre 12

// src/Acme/DemoBundle/Tests/Controller/DemoControllerTest.php namespace Acme\DemoBundle\Tests\Controller; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; class DemoControllerTest extends WebTestCase { !!!! public function testIndex () !!!! { !!!!!!!! $client = static:: createClient (); !!!!!!!! $crawler = $client -> request ( 'GET' , '/demo/hello/Fabien' ); !!!!!!!! $count = $crawler -> filter ( 'html:contains("Hello Fabien")' ) -> count (); !!!!!!!! $this -> assertGreaterThan ( 0 , $count ); !!!! } } CONTRïLE QUALITƒ Assertion mercredi 5 septembre 12

CONTRïLE QUALITƒ mercredi 5 septembre 12

ÒA PHP framework for testing your business expectations.Ó CONTRïLE QUALITƒ mercredi 5 septembre 12

Feature: buy an article In order to be happy As a consumer I want to be able to buy something Scenario: Given I am on the homepage When I search for " fridge " And I follow " Awesome Fridge " And I add the article to my cart And I follow " checkout " # steps that describe the checkout process Then I should see " Your order is complete! " And I should be happy to have a new fridge CONTRïLE QUALITƒ mercredi 5 septembre 12

Feature: buy an article In order to be happy As a consumer I want to be able to buy something Scenario: Given I am on the homepage When I search for " fridge " And I follow " Awesome Fridge " And I add the article to my cart And I follow " checkout " # steps that describe the checkout process Then I should see " Your order is complete! " And I should be happy to have a new fridge CONTRïLE QUALITƒ Step mercredi 5 septembre 12

CONTRïLE QUALITƒ /** * @When /^I search for "(?P[^"]*)"$/ */ public function iSearchFor ( $term ) { !!!! $this -> fillField ( 'Search' , $term ); !!!! $this -> pressButton ( 'Find' ); } mercredi 5 septembre 12

CONTRïLE QUALITƒ Extensible mercredi 5 septembre 12

CONTRïLE QUALITƒ Extensible Support de Selenium 1/2, ZombieJS, etc mercredi 5 septembre 12

CONTRïLE QUALITƒ Extensible Support de Selenium 1/2, ZombieJS, etc Extension Symfony 2 mercredi 5 septembre 12

http://behat.org/ CONTRïLE QUALITƒ mercredi 5 septembre 12

RƒSUMƒ mercredi 5 septembre 12

HTTP mercredi 5 septembre 12

HTTP Design Pattern MVC mercredi 5 septembre 12

HTTP Design Pattern MVC Injection de dependance mercredi 5 septembre 12

HTTP Design Pattern MVC Injection de dependance Composants mercredi 5 septembre 12

HTTP Design Pattern MVC Injection de dependance Composants Bundles mercredi 5 septembre 12

HTTP Design Pattern MVC Injection de dependance Composants Bundles Contr™le qualitŽ mercredi 5 septembre 12

Documentation complte mercredi 5 septembre 12

Documentation complte Sur le ÒframeworkÓ mercredi 5 septembre 12

Documentation complte Sur le ÒframeworkÓ Par composant mercredi 5 septembre 12

Documentation complte Sur le ÒframeworkÓ Par composant ÒCookbooksÓ mercredi 5 septembre 12

plus de 100 contributeurs mercredi 5 septembre 12

plus de 1600 bundles mercredi 5 septembre 12

Drupal mercredi 5 septembre 12

Drupal PHPBB mercredi 5 septembre 12

Drupal PHPBB Symfony-CMF / PHPCR mercredi 5 septembre 12

Drupal PHPBB Symfony-CMF / PHPCR Midgard / MIDCOM mercredi 5 septembre 12

Drupal PHPBB Symfony-CMF / PHPCR Midgard / MIDCOM ... mercredi 5 septembre 12

Pourquoi pas vous ? mercredi 5 septembre 12

Geoffrey Bachelet https://github.com/ubermuda https://twitter.com/ubermuda http://pandanova.com / http://knplabs.ca / geoffrey.bachelet@pandanova.com mercredi 5 septembre 12

Geoffrey Bachelet https://github.com/ubermuda https://twitter.com/ubermuda http://pandanova.com / http://knplabs.ca / geoffrey.bachelet@pandanova.com mercredi 5 septembre 12