SlideShare a Scribd company logo
1 of 49
Download to read offline
Welcome to the
       Symfony2 World



            Lukas Smith    Daniel Kucharski
             @lsmith        @inspiran_be


Saturday, February 2, 13
Speakers
          Lukas Kahwe Smith


                           • Developer at Liip AG in Switzerland
                           • PHP 5.3 co-release-manager,
                           • Contributing to Doctrine, Symfony,
                             PHPCR ..



Saturday, February 2, 13
Speakers
          Daniel Kucharski


                           • SAP Business Consultant by day
                           • PHP enthusiast at night since 2000
                           • Co-founder of the Vespolina Ecommerce
                             Project



Saturday, February 2, 13
What is Symfony2?
                     • Symfony2 is a reusable set of standalone,
                       decoupled and cohesive PHP components
                     • Symfony2 is also a full-stack framework
                     • MIT licensed (permissive, GPL compatible)
                     • Compliant with PSR-0 , PSR-1, PSR-2, PSR-3
                     • https://github.com/symfony/symfony


Saturday, February 2, 13
What is Symfony2?
                     • Approaching 700 contributors
                     • Most popular PHP project on github.com
                     • First stable release in July 2011
                     • LTS release with 5 year support in May 2013
                     • Used on many big sites: ted.com,
                           lockerz.com, opensky.com, exercise.com,
                           wetter.de, stern.de ..


Saturday, February 2, 13
Components




Saturday, February 2, 13
BrowserKit              Locale
             ClassLoader        OptionsResolver
                Config               Process
               Console          PropertyAccess
             CssSelector            Routing
             DomCrawler             Security
          DependencyInjection      Serializer
           EventDispatcher        Stopwatch
              Filesystem          Templating
                 Finder           Translation
                 Form              Validator
            HttpFoundation            Yaml
              HttpKernel
Saturday, February 2, 13
Yaml
                     • Easily parse and write YAML files
                     • Implements most of the YAML 1.2 spec
      use SymfonyComponentYamlParser;

      $yaml = new Parser();

      $string = file_get_contents('foo.yml')
      $data = $yaml->parse($string);

      # data, inlining, indenting, invalid types, objects
      $string = $yaml->dump($data, 2, 4, false, true);
      file_put_contents('bar.yml', $string);



Saturday, February 2, 13
Http Foundation
                     • OO API for HTTP Request + Response
                     • OO API for Session incl. “flash messages”
                     • Supports streaming response
       $request = Request::create('/?foo=bar', 'GET');
       echo $request->getPathInfo();

       $resp = JsonResponse::create($data, 200);

       $hdrs = array('Content-Type' => 'text/plain');
       $resp = new StreamingResponse($callback, 404, $hdrs);
       $resp->send();


Saturday, February 2, 13
HTTP Kernel
                     • PHP level CGI interface
                     • Eases integration between Symfony2, Silex,
                           Drupal8, ezPublish5, Laravel4 .. applications
       interface HttpKernelInterface
       {
         const MASTER_REQUEST = 1;
         const SUB_REQUEST = 2;

            public function handle(
               Request $request,
               $type = self::MASTER_REQUEST,
               $catch = true
            );
       }


Saturday, February 2, 13
HTTP Kernel
       use SymfonyComponentHttpFoundationRequest;

       // env: prod, debug: false
       $kernel = new AppKernel('prod', false);

       // wrap the kernel for ESI enabled HTTP caching
       $kernel = new AppCache($kernel);

       // create the request from the super globals
       $request = Request::createFromGlobals();

       // convert request into a response
       $response = $kernel->handle($request);

       // send response content to the client
       $response->send();

       // event fired after browser has received response
       $kernel->terminate($request, $response);




Saturday, February 2, 13
Component usage
            Frameworks / Applications Libraries / Components

                            Drupal 8         Doctrine
                           ezPublish 5         Assetic
                            Laravel 4          Guzzle
                           phpBB 3.5          PHPUnit
                               PPI             Behat
                              Silex            Goutte
                            shopware         Jackalope
                                ..               ..


Saturday, February 2, 13
Symfony2 Framework
                     • HTTP framework 1st , MVC framework 2nd
                     • Very extensible due to event based request
                           processing and dependency injection
                     • Inspired by Django, Spring, Ruby on Rails
                     • HTTP Caching / ESI / Reversed proxy
                     • Extensive documentation + debugging tools
Saturday, February 2, 13
Distributions
                     • Selection of bundles, a default directory / file
                           structure and default configuration
                     • Symfony Standard edition
                            php composer.phar create-project symfony/
                            framework-standard-edition your-dir

                     • Symfony CMF Standard edition
                     • Sonata standard edition
                     • KNP Rad Edition
Saturday, February 2, 13
What is a Bundle?

                 Ideally, the minimal glue code necessary to connect
                 a library with the symfony2 framework (ie. configure
                 the Dependency Injection Container) plus any required
                   controller and routes




Saturday, February 2, 13
Core bundles
                           FrameworkBundle
                            MonologBundle
                             AsseticBundle
                           WebProfilerBundle
                               TwigBundle
                           SwiftmailerBundle
                             SecurityBundle

                                   ..



Saturday, February 2, 13
KNPbundles.com




Saturday, February 2, 13
Popular bundles
                                  FOSUserBundle
                                SonataAdminBundle
                                  FOSRestBundle
                           StofDoctrineExtensionBundle
                                 KnpMenuBundle
                                        ..
                               NelmioApiDocBundle
                               JMSDebuggingBundle
                             LiipCacheControlBundle
                                   KnpRadBundle
                                        ..



Saturday, February 2, 13
The ecosystem
                  Core Dependencies            Popular Dependencies
                               Assetic                  Imagine
                              Monolog          Behat / PHPSpec / Atoum
                           Doctrine / Propel        Buzz / Guzzle
                                 Twig                   Goutte
                             Swiftmailer               KnpMenu
                              PHPUnit               JMS Serializer




Saturday, February 2, 13
Ecosystem




Saturday, February 2, 13
Composer




Saturday, February 2, 13
Composer
                 • Dependency manager for PHP
                 • Based on SUSE Linux dependency resolver
                 curl -s https://getcomposer.org/installer | php
                 php composer.phar install
                 php composer.phar require acme/lib:1.1.* --no-update
                 php composer.phar update acme/lib



                 • Register on packagist.org
                 • Setup your own package index with Satis

Saturday, February 2, 13
Twig




Saturday, February 2, 13
Twig
                     • Template language implemented in PHP
                     • Fast: Compiles to PHP and Javascript
                     • Template inheritance
                     • Secure: sandbox mode, output escaping
                     • Easily create new tags, filters and functions
                     • Many community extensions are available
Saturday, February 2, 13
Twig
       {% extends "base.html" %}

       {% block title %}Index{% endblock %}
       {% block head %}
           {{ parent() }}
           <style type="text/css">
                .important { color: #336699; }
           </style>
       {% endblock %}
       {% block content %}
         {% if users|length > 0 %}
           <ul>
                {% for user in users %}
                    <li>{{ user.username|e }}</li>
                {% endfor %}
           </ul>
       {% endif %}
       {% endblock %}




Saturday, February 2, 13
Assetic
                     • Cleverly handle your JS/CSS web assets
                     • Inspired by the Python webassets lib
                     • Assets : Combine, Less, Sass ...
                     • Filters : Minify,YUICompressor, ..
                     • Provides ways to handle cache busting
                     • Build assets on the fly during development
                           or dump to static files in production

Saturday, February 2, 13
Assetic
       {% stylesheets '@AcmeFooBundle/Resources/public/css/*' %}
           <link rel="stylesheet" href="{{ asset_url }}" />
       {% endstylesheets %}

       {% javascripts 'bundles/acme_foo/js/*' filter='yui_js' %}
           <script src="{{ asset_url }}"></script>
       {% endjavascripts %}

       # Assetic Configuration
       assetic:
         use_controller: false
         #java: /usr/bin/java
         filters:
           cssrewrite: ~
           # closure:
           #      jar: %kernel.root_dir%/java/compiler.jar
           # yui_css:
           #      jar: %kernel.root_dir%/java/yuicompressor-2.4.2.jar



Saturday, February 2, 13
Monolog
                     • PSR-3 compliant logging library
                     • Inspired by the Python logbook lib
                     •     Handlers

                           •   StreamHandler, RotatingFileHandler,
                               NativeMailHandler, MongoDBHandler, ...

                           •   FingersCrossedHandler

                     •     Channels, Formatters, Processors



Saturday, February 2, 13
Monolog
       // create a log channel
       $log = new Logger('name');
       $fileName = 'path/to/your.log';
       $handler = new StreamHandler($fileName, Logger::WARNING);

       // log everything if there is at least one warning or higher
       $log->pushHandler(new FingersCrossedHandler($handler);
       $logger->pushHandler(new FirePHPHandler());

       $socketName = 'unix:///var/log/httpd_app_log.socket';
       $handler = new SocketHandler($socketName);
       $handler->setPersistent(true);
       $logger->pushHandler($handler, Logger::DEBUG);

       // add records to the log
       $log->addWarning('Foo');
       $log->log(Logger::ERROR, 'Bar');




Saturday, February 2, 13
Doctrine
                     • Hibernate inspired data mapper API
                     • ORM Object Relational Mapper (SQL)
                     • Object Document Mapper (CouchDB,
                           MongoDB, PHPCR, OrientDB, ..)
                     • DBAL / Migrations / Fixtures
                     • Annotations, Cache, Inflector, Lexer ..
Saturday, February 2, 13
JMS Serializer
                     • (De)serializing on steroids
                     • Handles nested (recursive) object graphs
                     • Fully leverage XML/JSON/.. features
                     • Exclusion strategies for groups, versioning

                     • Ability to define custom exclusion
                           strategies and events handlers


Saturday, February 2, 13
JMS Serializer
       class BlogPost
       {
         private $title;
         private $content;
         private $date;

       /* @XmlList(inline = true, entry = "tag") */
         private $tags;
         /* @Groups({"admins"})
          * @XmlAttribute
          * @Since("1.1.0") */
         private $version;
         /* @VirtualProperty
          * @SerializedName("slug")
          * @XmlAttribute */
         public function getSlug() { .. }

            ..
       }




Saturday, February 2, 13
JMS Serializer
       // sets the group exclusion strategy
       $serializer->setGroups(array(‘admins’));

       // sets the version exclusion strategy
       // this overrides the group exclusion strategy
       // need to define your own class to combine the two
       $serializer->setVersion(‘1.2.0’);

       $blogPost = new BlogPost($data);
       $serializer->serialize($blogPost, 'json');




Saturday, February 2, 13
Bridges




Saturday, February 2, 13
Bridges

                              TwigBridge
                           SwiftmailerBridge
                            MonologBridge
                            DoctrineBridge
                            Propel1Bridge



Saturday, February 2, 13
Applications




Saturday, February 2, 13
Symfony CMF
                 The Symfony CMF project makes it easier for developers
                 to add CMS functionality to applications built with the
                 Symfony2 framework. Key development principles for the
                 provided sets of bundles are scalability , usability ,
                  documentation and testing .




Saturday, February 2, 13
Symfony CMF
                     • Follows vision of the decoupled CMS on top of
                           Symfony2, PHPCR, Create.js
                     • CMF as target audience are CMS builders:
                           Drupal 8, ezPublish 5, Symfony2 devs, ..
                     • Stable release planned for May 2013
                     • http://cmf.symfony.com
                     • Demo at http://cmf.liip.ch
Saturday, February 2, 13
A decoupled CMS
                     • Decoupled storage, business logic, UI layers
                     • PHPCR is a storage API for CMS, essentially
                           a tree + versioning enabled document DB
                     • Symfony2 handles the business logic
                     • create.js is a glue layer that ties together
                           RDFa, backbone.js, inline edit + JSON-LD


Saturday, February 2, 13
Vespolina Project
                     •      scalable Ecommerce application

                           • from a single person store
                           • to a multi national store.
                     • Decoupled components which can be used
                           independently of Symfony2
                     • Several components will go stable in Q2
                     • http://www.vespolina-project.org
Saturday, February 2, 13
Vespolina Project
              vespolina/vespolinaProductBundle
                           defining managers a DI service




                                      vespolina/vespolinaProduct
                                                   manager & mappings



                                                           vespolina/vespolinaCore
                                                               base classes & interfaces
                                   Framework agnostic


Saturday, February 2, 13
References
                     •     http://fabien.potencier.org/article/49/what-is-symfony2

                     •     http://fabien.potencier.org/article/50/create-your-own-
                           framework-on-top-of-the-symfony2-components-
                           part-1

                     •     http://symfony.com/components

                     •     http://cmf.symfony.com/slides/

                     •     https://speakerdeck.com/hhamon/useful-php-
                           librarieswhy_symfony_cmf.html



Saturday, February 2, 13
Questions?


                              Please rate this talk on

                           http://joind.in/talk/view/8074




Saturday, February 2, 13
Guzzle

                     • HTTP client & framework
                     • Restful web service clients
                     • Used by Amazon AWS SDK, Drupal 8, ...
                     • Uses Symfony Event dispatcher
                     • Service descriptions

Saturday, February 2, 13
Guzzle
       use GuzzleHttpClient;
       $client = new Client('https://api.github.com');

       $request = $client->get('/user')->setAuth('user',
       'pass');
       // Send the request and get the response
       $response = $request->send();




Saturday, February 2, 13
Guzzle
       {
                    "name": "Foo",               Service Description
                    "apiVersion": "2012-10-14",
                    "baseUrl": "http://api.foo.com",
                    "description": "Foo is an API",
                    "operations": {
                        "GetUsers": {
                            "httpMethod": "GET",
                            "uri": "/users",
                            "summary": "Gets a list of users",
                            "responseClass": "GetUsersOutput"
                        },
       ...



Saturday, February 2, 13
Guzzle
       ...
                 "GetUserOutput": {           Service Description
                          "type": "object",
                          "properties": {
                              "name": {
                                  "location": "json",
                                  "type": "string"
                              },
                              "age": {
                                  "location": "json",
                                  "type": "integer"
       ...




Saturday, February 2, 13
Guzzle
       use GuzzleServiceDescriptionServiceDescription;

       $description =
       ServiceDescription::factory('service_description.js
       on');
       $client->setDescription($description);

       $command = $client->getCommand('GetUser',
                   array('id' => 123));
       $responseModel = $client->execute($command);
       echo $responseModel['age'];




Saturday, February 2, 13
Sonata Project
                           • Collection of bundles to quickly create an
                             Admin interface
                           • Media, News, Notification, Formatter,
                             I18N,




Saturday, February 2, 13

More Related Content

What's hot

TorqueBox - Ultrapassando a fronteira entre Java e Ruby
TorqueBox - Ultrapassando a fronteira entre Java e RubyTorqueBox - Ultrapassando a fronteira entre Java e Ruby
TorqueBox - Ultrapassando a fronteira entre Java e RubyBruno Oliveira
 
TorqueBox: The beauty of Ruby with the power of JBoss. Presented at Devnexus...
TorqueBox: The beauty of Ruby with the power of JBoss.  Presented at Devnexus...TorqueBox: The beauty of Ruby with the power of JBoss.  Presented at Devnexus...
TorqueBox: The beauty of Ruby with the power of JBoss. Presented at Devnexus...bobmcwhirter
 
How to distribute Ruby to the world
How to distribute Ruby to the worldHow to distribute Ruby to the world
How to distribute Ruby to the worldHiroshi SHIBATA
 
TorqueBox at DC:JBUG - November 2011
TorqueBox at DC:JBUG - November 2011TorqueBox at DC:JBUG - November 2011
TorqueBox at DC:JBUG - November 2011bobmcwhirter
 
Fiber in the 10th year
Fiber in the 10th yearFiber in the 10th year
Fiber in the 10th yearKoichi Sasada
 
Running Ruby on Solaris (RubyKaigi 2015, 12/Dec/2015)
Running Ruby on Solaris (RubyKaigi 2015, 12/Dec/2015)Running Ruby on Solaris (RubyKaigi 2015, 12/Dec/2015)
Running Ruby on Solaris (RubyKaigi 2015, 12/Dec/2015)ngotogenome
 
Puppet at Opera Sofware - PuppetCamp Oslo 2013
Puppet at Opera Sofware - PuppetCamp Oslo 2013Puppet at Opera Sofware - PuppetCamp Oslo 2013
Puppet at Opera Sofware - PuppetCamp Oslo 2013Cosimo Streppone
 
DataMapper on Infinispan
DataMapper on InfinispanDataMapper on Infinispan
DataMapper on InfinispanLance Ball
 
Using Puppet on Linux, Windows, and Mac OSX
Using Puppet on Linux, Windows, and Mac OSXUsing Puppet on Linux, Windows, and Mac OSX
Using Puppet on Linux, Windows, and Mac OSXPuppet
 
Bypat博客出品-手把手教你如何建立自己的linux系统lfs速成手册
Bypat博客出品-手把手教你如何建立自己的linux系统lfs速成手册Bypat博客出品-手把手教你如何建立自己的linux系统lfs速成手册
Bypat博客出品-手把手教你如何建立自己的linux系统lfs速成手册redhat9
 
When Ruby Meets Java - The Power of Torquebox
When Ruby Meets Java - The Power of TorqueboxWhen Ruby Meets Java - The Power of Torquebox
When Ruby Meets Java - The Power of Torqueboxrockyjaiswal
 
The Future of Bundled Bundler
The Future of Bundled BundlerThe Future of Bundled Bundler
The Future of Bundled BundlerHiroshi SHIBATA
 
Python for System Administrators
Python for System AdministratorsPython for System Administrators
Python for System AdministratorsRoberto Polli
 

What's hot (20)

An Introduction to Python Concurrency
An Introduction to Python ConcurrencyAn Introduction to Python Concurrency
An Introduction to Python Concurrency
 
Perl-C/C++ Integration with Swig
Perl-C/C++ Integration with SwigPerl-C/C++ Integration with Swig
Perl-C/C++ Integration with Swig
 
Understanding the Python GIL
Understanding the Python GILUnderstanding the Python GIL
Understanding the Python GIL
 
TorqueBox - Ultrapassando a fronteira entre Java e Ruby
TorqueBox - Ultrapassando a fronteira entre Java e RubyTorqueBox - Ultrapassando a fronteira entre Java e Ruby
TorqueBox - Ultrapassando a fronteira entre Java e Ruby
 
Hp ux-security-check
Hp ux-security-checkHp ux-security-check
Hp ux-security-check
 
Python in Action (Part 2)
Python in Action (Part 2)Python in Action (Part 2)
Python in Action (Part 2)
 
Devignition 2011
Devignition 2011Devignition 2011
Devignition 2011
 
TorqueBox: The beauty of Ruby with the power of JBoss. Presented at Devnexus...
TorqueBox: The beauty of Ruby with the power of JBoss.  Presented at Devnexus...TorqueBox: The beauty of Ruby with the power of JBoss.  Presented at Devnexus...
TorqueBox: The beauty of Ruby with the power of JBoss. Presented at Devnexus...
 
How to distribute Ruby to the world
How to distribute Ruby to the worldHow to distribute Ruby to the world
How to distribute Ruby to the world
 
TorqueBox at DC:JBUG - November 2011
TorqueBox at DC:JBUG - November 2011TorqueBox at DC:JBUG - November 2011
TorqueBox at DC:JBUG - November 2011
 
Fiber in the 10th year
Fiber in the 10th yearFiber in the 10th year
Fiber in the 10th year
 
Running Ruby on Solaris (RubyKaigi 2015, 12/Dec/2015)
Running Ruby on Solaris (RubyKaigi 2015, 12/Dec/2015)Running Ruby on Solaris (RubyKaigi 2015, 12/Dec/2015)
Running Ruby on Solaris (RubyKaigi 2015, 12/Dec/2015)
 
Puppet at Opera Sofware - PuppetCamp Oslo 2013
Puppet at Opera Sofware - PuppetCamp Oslo 2013Puppet at Opera Sofware - PuppetCamp Oslo 2013
Puppet at Opera Sofware - PuppetCamp Oslo 2013
 
DataMapper on Infinispan
DataMapper on InfinispanDataMapper on Infinispan
DataMapper on Infinispan
 
Using Puppet on Linux, Windows, and Mac OSX
Using Puppet on Linux, Windows, and Mac OSXUsing Puppet on Linux, Windows, and Mac OSX
Using Puppet on Linux, Windows, and Mac OSX
 
Bypat博客出品-手把手教你如何建立自己的linux系统lfs速成手册
Bypat博客出品-手把手教你如何建立自己的linux系统lfs速成手册Bypat博客出品-手把手教你如何建立自己的linux系统lfs速成手册
Bypat博客出品-手把手教你如何建立自己的linux系统lfs速成手册
 
When Ruby Meets Java - The Power of Torquebox
When Ruby Meets Java - The Power of TorqueboxWhen Ruby Meets Java - The Power of Torquebox
When Ruby Meets Java - The Power of Torquebox
 
The Future of Bundled Bundler
The Future of Bundled BundlerThe Future of Bundled Bundler
The Future of Bundled Bundler
 
Mastering Python 3 I/O
Mastering Python 3 I/OMastering Python 3 I/O
Mastering Python 3 I/O
 
Python for System Administrators
Python for System AdministratorsPython for System Administrators
Python for System Administrators
 

Similar to Welcome to the Symfony2 World - FOSDEM 2013

Starting with Symfony2
Starting with Symfony2Starting with Symfony2
Starting with Symfony2Kevin Bond
 
Symony2 A Next Generation PHP Framework
Symony2 A Next Generation PHP FrameworkSymony2 A Next Generation PHP Framework
Symony2 A Next Generation PHP FrameworkRyan Weaver
 
Symfony Components 2.0 on PHP 5.3
Symfony Components 2.0 on PHP 5.3Symfony Components 2.0 on PHP 5.3
Symfony Components 2.0 on PHP 5.3Fabien Potencier
 
Puppet without Root - PuppetConf 2013
Puppet without Root - PuppetConf 2013Puppet without Root - PuppetConf 2013
Puppet without Root - PuppetConf 2013Puppet
 
One hour application - PHP Quebec Conference 2009
One hour application - PHP Quebec Conference 2009One hour application - PHP Quebec Conference 2009
One hour application - PHP Quebec Conference 2009Philippe Gamache
 
IronRuby for the Rubyist
IronRuby for the RubyistIronRuby for the Rubyist
IronRuby for the RubyistWill Green
 
Testing your infallibleness
Testing your infalliblenessTesting your infallibleness
Testing your infalliblenessCorey Osman
 
Interoperable PHP
Interoperable PHPInteroperable PHP
Interoperable PHPweltling
 
Symfony2 San Francisco Meetup 2009
Symfony2 San Francisco Meetup 2009Symfony2 San Francisco Meetup 2009
Symfony2 San Francisco Meetup 2009Fabien Potencier
 
Grâce aux tags Varnish, j'ai switché ma prod sur Raspberry Pi
Grâce aux tags Varnish, j'ai switché ma prod sur Raspberry PiGrâce aux tags Varnish, j'ai switché ma prod sur Raspberry Pi
Grâce aux tags Varnish, j'ai switché ma prod sur Raspberry PiJérémy Derussé
 
How to Make a Honeypot Stickier (SSH*)
How to Make a Honeypot Stickier (SSH*)How to Make a Honeypot Stickier (SSH*)
How to Make a Honeypot Stickier (SSH*)Jose Hernandez
 
Composer Tutorial (PHP Hampshire Sept 2013)
Composer Tutorial (PHP Hampshire Sept 2013)Composer Tutorial (PHP Hampshire Sept 2013)
Composer Tutorial (PHP Hampshire Sept 2013)James Titcumb
 
これからのPerlプロダクトのかたち(YAPC::Asia 2013)
これからのPerlプロダクトのかたち(YAPC::Asia 2013)これからのPerlプロダクトのかたち(YAPC::Asia 2013)
これからのPerlプロダクトのかたち(YAPC::Asia 2013)goccy
 
Symfony Live 09 Symfony 2
Symfony Live 09 Symfony 2Symfony Live 09 Symfony 2
Symfony Live 09 Symfony 2narkoza
 
Deployment presentation
Deployment presentationDeployment presentation
Deployment presentationCorey Purcell
 
Hacking Robotics(English Version)
Hacking Robotics(English Version)Hacking Robotics(English Version)
Hacking Robotics(English Version)Kensei Demura
 
Linux Kernel Exploitation
Linux Kernel ExploitationLinux Kernel Exploitation
Linux Kernel ExploitationScio Security
 

Similar to Welcome to the Symfony2 World - FOSDEM 2013 (20)

Starting with Symfony2
Starting with Symfony2Starting with Symfony2
Starting with Symfony2
 
Symfony 2.0 on PHP 5.3
Symfony 2.0 on PHP 5.3Symfony 2.0 on PHP 5.3
Symfony 2.0 on PHP 5.3
 
Symony2 A Next Generation PHP Framework
Symony2 A Next Generation PHP FrameworkSymony2 A Next Generation PHP Framework
Symony2 A Next Generation PHP Framework
 
Symfony Components 2.0 on PHP 5.3
Symfony Components 2.0 on PHP 5.3Symfony Components 2.0 on PHP 5.3
Symfony Components 2.0 on PHP 5.3
 
Puppet without Root - PuppetConf 2013
Puppet without Root - PuppetConf 2013Puppet without Root - PuppetConf 2013
Puppet without Root - PuppetConf 2013
 
One hour application - PHP Quebec Conference 2009
One hour application - PHP Quebec Conference 2009One hour application - PHP Quebec Conference 2009
One hour application - PHP Quebec Conference 2009
 
IronRuby for the Rubyist
IronRuby for the RubyistIronRuby for the Rubyist
IronRuby for the Rubyist
 
Testing your infallibleness
Testing your infalliblenessTesting your infallibleness
Testing your infallibleness
 
Interoperable PHP
Interoperable PHPInteroperable PHP
Interoperable PHP
 
Homebrew atlrug
Homebrew atlrugHomebrew atlrug
Homebrew atlrug
 
Jaoo irony
Jaoo ironyJaoo irony
Jaoo irony
 
Symfony2 San Francisco Meetup 2009
Symfony2 San Francisco Meetup 2009Symfony2 San Francisco Meetup 2009
Symfony2 San Francisco Meetup 2009
 
Grâce aux tags Varnish, j'ai switché ma prod sur Raspberry Pi
Grâce aux tags Varnish, j'ai switché ma prod sur Raspberry PiGrâce aux tags Varnish, j'ai switché ma prod sur Raspberry Pi
Grâce aux tags Varnish, j'ai switché ma prod sur Raspberry Pi
 
How to Make a Honeypot Stickier (SSH*)
How to Make a Honeypot Stickier (SSH*)How to Make a Honeypot Stickier (SSH*)
How to Make a Honeypot Stickier (SSH*)
 
Composer Tutorial (PHP Hampshire Sept 2013)
Composer Tutorial (PHP Hampshire Sept 2013)Composer Tutorial (PHP Hampshire Sept 2013)
Composer Tutorial (PHP Hampshire Sept 2013)
 
これからのPerlプロダクトのかたち(YAPC::Asia 2013)
これからのPerlプロダクトのかたち(YAPC::Asia 2013)これからのPerlプロダクトのかたち(YAPC::Asia 2013)
これからのPerlプロダクトのかたち(YAPC::Asia 2013)
 
Symfony Live 09 Symfony 2
Symfony Live 09 Symfony 2Symfony Live 09 Symfony 2
Symfony Live 09 Symfony 2
 
Deployment presentation
Deployment presentationDeployment presentation
Deployment presentation
 
Hacking Robotics(English Version)
Hacking Robotics(English Version)Hacking Robotics(English Version)
Hacking Robotics(English Version)
 
Linux Kernel Exploitation
Linux Kernel ExploitationLinux Kernel Exploitation
Linux Kernel Exploitation
 

Recently uploaded

Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 

Recently uploaded (20)

Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 

Welcome to the Symfony2 World - FOSDEM 2013

  • 1. Welcome to the Symfony2 World Lukas Smith Daniel Kucharski @lsmith @inspiran_be Saturday, February 2, 13
  • 2. Speakers Lukas Kahwe Smith • Developer at Liip AG in Switzerland • PHP 5.3 co-release-manager, • Contributing to Doctrine, Symfony, PHPCR .. Saturday, February 2, 13
  • 3. Speakers Daniel Kucharski • SAP Business Consultant by day • PHP enthusiast at night since 2000 • Co-founder of the Vespolina Ecommerce Project Saturday, February 2, 13
  • 4. What is Symfony2? • Symfony2 is a reusable set of standalone, decoupled and cohesive PHP components • Symfony2 is also a full-stack framework • MIT licensed (permissive, GPL compatible) • Compliant with PSR-0 , PSR-1, PSR-2, PSR-3 • https://github.com/symfony/symfony Saturday, February 2, 13
  • 5. What is Symfony2? • Approaching 700 contributors • Most popular PHP project on github.com • First stable release in July 2011 • LTS release with 5 year support in May 2013 • Used on many big sites: ted.com, lockerz.com, opensky.com, exercise.com, wetter.de, stern.de .. Saturday, February 2, 13
  • 7. BrowserKit Locale ClassLoader OptionsResolver Config Process Console PropertyAccess CssSelector Routing DomCrawler Security DependencyInjection Serializer EventDispatcher Stopwatch Filesystem Templating Finder Translation Form Validator HttpFoundation Yaml HttpKernel Saturday, February 2, 13
  • 8. Yaml • Easily parse and write YAML files • Implements most of the YAML 1.2 spec use SymfonyComponentYamlParser; $yaml = new Parser(); $string = file_get_contents('foo.yml') $data = $yaml->parse($string); # data, inlining, indenting, invalid types, objects $string = $yaml->dump($data, 2, 4, false, true); file_put_contents('bar.yml', $string); Saturday, February 2, 13
  • 9. Http Foundation • OO API for HTTP Request + Response • OO API for Session incl. “flash messages” • Supports streaming response $request = Request::create('/?foo=bar', 'GET'); echo $request->getPathInfo(); $resp = JsonResponse::create($data, 200); $hdrs = array('Content-Type' => 'text/plain'); $resp = new StreamingResponse($callback, 404, $hdrs); $resp->send(); Saturday, February 2, 13
  • 10. HTTP Kernel • PHP level CGI interface • Eases integration between Symfony2, Silex, Drupal8, ezPublish5, Laravel4 .. applications interface HttpKernelInterface { const MASTER_REQUEST = 1; const SUB_REQUEST = 2; public function handle( Request $request, $type = self::MASTER_REQUEST, $catch = true ); } Saturday, February 2, 13
  • 11. HTTP Kernel use SymfonyComponentHttpFoundationRequest; // env: prod, debug: false $kernel = new AppKernel('prod', false); // wrap the kernel for ESI enabled HTTP caching $kernel = new AppCache($kernel); // create the request from the super globals $request = Request::createFromGlobals(); // convert request into a response $response = $kernel->handle($request); // send response content to the client $response->send(); // event fired after browser has received response $kernel->terminate($request, $response); Saturday, February 2, 13
  • 12. Component usage Frameworks / Applications Libraries / Components Drupal 8 Doctrine ezPublish 5 Assetic Laravel 4 Guzzle phpBB 3.5 PHPUnit PPI Behat Silex Goutte shopware Jackalope .. .. Saturday, February 2, 13
  • 13. Symfony2 Framework • HTTP framework 1st , MVC framework 2nd • Very extensible due to event based request processing and dependency injection • Inspired by Django, Spring, Ruby on Rails • HTTP Caching / ESI / Reversed proxy • Extensive documentation + debugging tools Saturday, February 2, 13
  • 14. Distributions • Selection of bundles, a default directory / file structure and default configuration • Symfony Standard edition php composer.phar create-project symfony/ framework-standard-edition your-dir • Symfony CMF Standard edition • Sonata standard edition • KNP Rad Edition Saturday, February 2, 13
  • 15. What is a Bundle? Ideally, the minimal glue code necessary to connect a library with the symfony2 framework (ie. configure the Dependency Injection Container) plus any required controller and routes Saturday, February 2, 13
  • 16. Core bundles FrameworkBundle MonologBundle AsseticBundle WebProfilerBundle TwigBundle SwiftmailerBundle SecurityBundle .. Saturday, February 2, 13
  • 18. Popular bundles FOSUserBundle SonataAdminBundle FOSRestBundle StofDoctrineExtensionBundle KnpMenuBundle .. NelmioApiDocBundle JMSDebuggingBundle LiipCacheControlBundle KnpRadBundle .. Saturday, February 2, 13
  • 19. The ecosystem Core Dependencies Popular Dependencies Assetic Imagine Monolog Behat / PHPSpec / Atoum Doctrine / Propel Buzz / Guzzle Twig Goutte Swiftmailer KnpMenu PHPUnit JMS Serializer Saturday, February 2, 13
  • 22. Composer • Dependency manager for PHP • Based on SUSE Linux dependency resolver curl -s https://getcomposer.org/installer | php php composer.phar install php composer.phar require acme/lib:1.1.* --no-update php composer.phar update acme/lib • Register on packagist.org • Setup your own package index with Satis Saturday, February 2, 13
  • 24. Twig • Template language implemented in PHP • Fast: Compiles to PHP and Javascript • Template inheritance • Secure: sandbox mode, output escaping • Easily create new tags, filters and functions • Many community extensions are available Saturday, February 2, 13
  • 25. Twig {% extends "base.html" %} {% block title %}Index{% endblock %} {% block head %} {{ parent() }} <style type="text/css"> .important { color: #336699; } </style> {% endblock %} {% block content %} {% if users|length > 0 %} <ul> {% for user in users %} <li>{{ user.username|e }}</li> {% endfor %} </ul> {% endif %} {% endblock %} Saturday, February 2, 13
  • 26. Assetic • Cleverly handle your JS/CSS web assets • Inspired by the Python webassets lib • Assets : Combine, Less, Sass ... • Filters : Minify,YUICompressor, .. • Provides ways to handle cache busting • Build assets on the fly during development or dump to static files in production Saturday, February 2, 13
  • 27. Assetic {% stylesheets '@AcmeFooBundle/Resources/public/css/*' %} <link rel="stylesheet" href="{{ asset_url }}" /> {% endstylesheets %} {% javascripts 'bundles/acme_foo/js/*' filter='yui_js' %} <script src="{{ asset_url }}"></script> {% endjavascripts %} # Assetic Configuration assetic: use_controller: false #java: /usr/bin/java filters: cssrewrite: ~ # closure: # jar: %kernel.root_dir%/java/compiler.jar # yui_css: # jar: %kernel.root_dir%/java/yuicompressor-2.4.2.jar Saturday, February 2, 13
  • 28. Monolog • PSR-3 compliant logging library • Inspired by the Python logbook lib • Handlers • StreamHandler, RotatingFileHandler, NativeMailHandler, MongoDBHandler, ... • FingersCrossedHandler • Channels, Formatters, Processors Saturday, February 2, 13
  • 29. Monolog // create a log channel $log = new Logger('name'); $fileName = 'path/to/your.log'; $handler = new StreamHandler($fileName, Logger::WARNING); // log everything if there is at least one warning or higher $log->pushHandler(new FingersCrossedHandler($handler); $logger->pushHandler(new FirePHPHandler()); $socketName = 'unix:///var/log/httpd_app_log.socket'; $handler = new SocketHandler($socketName); $handler->setPersistent(true); $logger->pushHandler($handler, Logger::DEBUG); // add records to the log $log->addWarning('Foo'); $log->log(Logger::ERROR, 'Bar'); Saturday, February 2, 13
  • 30. Doctrine • Hibernate inspired data mapper API • ORM Object Relational Mapper (SQL) • Object Document Mapper (CouchDB, MongoDB, PHPCR, OrientDB, ..) • DBAL / Migrations / Fixtures • Annotations, Cache, Inflector, Lexer .. Saturday, February 2, 13
  • 31. JMS Serializer • (De)serializing on steroids • Handles nested (recursive) object graphs • Fully leverage XML/JSON/.. features • Exclusion strategies for groups, versioning • Ability to define custom exclusion strategies and events handlers Saturday, February 2, 13
  • 32. JMS Serializer class BlogPost { private $title; private $content; private $date; /* @XmlList(inline = true, entry = "tag") */ private $tags; /* @Groups({"admins"}) * @XmlAttribute * @Since("1.1.0") */ private $version; /* @VirtualProperty * @SerializedName("slug") * @XmlAttribute */ public function getSlug() { .. } .. } Saturday, February 2, 13
  • 33. JMS Serializer // sets the group exclusion strategy $serializer->setGroups(array(‘admins’)); // sets the version exclusion strategy // this overrides the group exclusion strategy // need to define your own class to combine the two $serializer->setVersion(‘1.2.0’); $blogPost = new BlogPost($data); $serializer->serialize($blogPost, 'json'); Saturday, February 2, 13
  • 35. Bridges TwigBridge SwiftmailerBridge MonologBridge DoctrineBridge Propel1Bridge Saturday, February 2, 13
  • 37. Symfony CMF The Symfony CMF project makes it easier for developers to add CMS functionality to applications built with the Symfony2 framework. Key development principles for the provided sets of bundles are scalability , usability , documentation and testing . Saturday, February 2, 13
  • 38. Symfony CMF • Follows vision of the decoupled CMS on top of Symfony2, PHPCR, Create.js • CMF as target audience are CMS builders: Drupal 8, ezPublish 5, Symfony2 devs, .. • Stable release planned for May 2013 • http://cmf.symfony.com • Demo at http://cmf.liip.ch Saturday, February 2, 13
  • 39. A decoupled CMS • Decoupled storage, business logic, UI layers • PHPCR is a storage API for CMS, essentially a tree + versioning enabled document DB • Symfony2 handles the business logic • create.js is a glue layer that ties together RDFa, backbone.js, inline edit + JSON-LD Saturday, February 2, 13
  • 40. Vespolina Project • scalable Ecommerce application • from a single person store • to a multi national store. • Decoupled components which can be used independently of Symfony2 • Several components will go stable in Q2 • http://www.vespolina-project.org Saturday, February 2, 13
  • 41. Vespolina Project vespolina/vespolinaProductBundle defining managers a DI service vespolina/vespolinaProduct manager & mappings vespolina/vespolinaCore base classes & interfaces Framework agnostic Saturday, February 2, 13
  • 42. References • http://fabien.potencier.org/article/49/what-is-symfony2 • http://fabien.potencier.org/article/50/create-your-own- framework-on-top-of-the-symfony2-components- part-1 • http://symfony.com/components • http://cmf.symfony.com/slides/ • https://speakerdeck.com/hhamon/useful-php- librarieswhy_symfony_cmf.html Saturday, February 2, 13
  • 43. Questions? Please rate this talk on http://joind.in/talk/view/8074 Saturday, February 2, 13
  • 44. Guzzle • HTTP client & framework • Restful web service clients • Used by Amazon AWS SDK, Drupal 8, ... • Uses Symfony Event dispatcher • Service descriptions Saturday, February 2, 13
  • 45. Guzzle use GuzzleHttpClient; $client = new Client('https://api.github.com'); $request = $client->get('/user')->setAuth('user', 'pass'); // Send the request and get the response $response = $request->send(); Saturday, February 2, 13
  • 46. Guzzle { "name": "Foo", Service Description "apiVersion": "2012-10-14", "baseUrl": "http://api.foo.com", "description": "Foo is an API", "operations": { "GetUsers": { "httpMethod": "GET", "uri": "/users", "summary": "Gets a list of users", "responseClass": "GetUsersOutput" }, ... Saturday, February 2, 13
  • 47. Guzzle ... "GetUserOutput": { Service Description "type": "object", "properties": { "name": { "location": "json", "type": "string" }, "age": { "location": "json", "type": "integer" ... Saturday, February 2, 13
  • 48. Guzzle use GuzzleServiceDescriptionServiceDescription; $description = ServiceDescription::factory('service_description.js on'); $client->setDescription($description); $command = $client->getCommand('GetUser', array('id' => 123)); $responseModel = $client->execute($command); echo $responseModel['age']; Saturday, February 2, 13
  • 49. Sonata Project • Collection of bundles to quickly create an Admin interface • Media, News, Notification, Formatter, I18N, Saturday, February 2, 13