Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Fabien Potencier
A bit of history
symfony 1.0 – January 2007
•  Started as a glue between existing Open-Source libraries:
   – Mojavi (heavily modified), Pro...
symfony 1.2 – November 2008
•  Based on decoupled but cohesive components

   –  Forms, Routing, Cache, YAML, ORMs, …

•  ...
symfony 1.4 – November 2009
•  Added some polish on existing features

•  Removed the support for deprecated features

•  ...
Symfony Components
  YAML
  Dependency Injection Container
  Event Dispatcher
  Templating
  Routing
  Console
  Output Es...
What is Symfony 2?
Symfony 2 is the next version
        of the symfony framework…

except Symfony now takes a S instead of a s
Talk about
Symfony 2
     or
 symfony 1
To make it clear:
      Symfony 1
does not make any sense
symfony 2
does not make more sense
Symfony 2
Same philosophy,
   just better
MVC
hmmm,
now that I think about it…
…it’s now probably more
a Fabien’s style framework
    than anything else
Highly configurable
    Highly extensible
Same Symfony Components
Same great developer tools
      Full-featured
Ok, but why a major version then?
Symfony 2 has
    a brand new
low-level architecture
PHP 5.3
A Quick Tour
<?php

require_once __DIR__.'/../blog/BlogKernel.php';

$kernel = new BlogKernel('prod', false);
$kernel->run();
<?php                             Everything is namespaced
namespace ApplicationHelloBundleController;

use SymfonyFramewo...
Layout

<?php $view->extend('HelloBundle::layout') ?>

Hello <?php echo $name ?>!
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html;
charset=utf-8" />
  </head>
  <body>
    <?php $vi...
hello:
  pattern: /hello/:name
  defaults:
    _bundle:     HelloBundle
    _controller: Hello
    _action:     index
hello:
  pattern: /hello/:name
  defaults:
    _bundle:     HelloBundle
    _controller: Hello
    _action:     index

nam...
hello:
  pattern: /hello/:name
  defaults:
    _bundle:     HelloBundle
    _controller: Hello
    _action:     index

nam...
hello:
  pattern: /hello/:name
  defaults:
    _bundle:     HelloBundle
    _controller: Hello
    _action:     index

nam...
hello:
  pattern: /hello/:name
  defaults:
    _bundle:     HelloBundle
    _controller: Hello
    _action:     index

nam...
hello:
  pattern: /hello/:name
  defaults:
    _bundle:     HelloBundle
    _controller: Hello
    _action:     index

nam...
hello:
  pattern: /hello/:year/:month/:slug
  defaults:
    _bundle:     HelloBundle
    _controller: Hello
    _action:  ...
Extremely
Configurable
Dependency
 Injection
 Container
Replaces a lot of symfony 1 “things”
                     sfConfig
                  All config handlers
         sfProject...
in one
   easy-to-master
       unified
and cohesive package
Thanks to the DIC,
Configuration has never been
   so easy and so flexible
Name your configuration files
     the way you want
Store them where you want
Use PHP, XML, YAML, or INI
$configuration = new BuilderConfiguration();
$configuration->addResource(new FileResource(__FILE__));

$configuration
  ->...
web.user:
    default_culture: fr
    session: { name: SYMFONY, type: Native, lifetime: 3600 }

web.templating:
  escaping...
<web:user default_culture="fr">
  <web:session name="SYMFONY" type="Native" lifetime="3600" />
</web:user>

<web:templatin...
$configuration->mergeExtension('swift.mailer', array(
    'transport' => 'gmail',
    'username' => 'fabien.potencier',
  ...
swift.mailer:
  transport: gmail
  username: fabien.potencier
  password: xxxxxxxx

                               YAML	
  
<swift:mailer
  transport="gmail"
  username="fabien.potencier"
  password="xxxxxxxx" />

                                ...
<?xml version="1.0" ?>

<container xmlns="http://www.symfony-project.org/schema/dic/services"
    xmlns:xsi="http://www.w3...
<?xml version="1.0" ?>

<container xmlns="http://www.symfony-project.org/schema/dic/services"
    xmlns:xsi="http://www.w3...
Inherit them as much as you want
Mix and match
configuration files written in any
            format
   useful when using third-party plugins
<imports>
  <import resource="parent.xml" />
  <import resource="config.yml" />
                                     Mix a...
You choose the format you want

                       Pros                    Cons
 XML                   validation     ...
Store sensitive settings
 outside of your project
<doctrine:dbal
   dbname="sfweb"
   username="root"
   password="SuperSecretPasswordThatAnyoneCanSee"
/>
in a .htaccess or httpd.conf file

SetEnv SYMFONY__DOCTRINE__DBAL__PASSWORD "foobar"
                             %doctrine...
Semantic
Configuration
<swift:mailer
  transport="gmail"
  username="fabien.potencier"
  password="xxxxxxxx" />

                                ...
<swift:mailer
   transport="smtp"
   encryption="ssl"
   auth_mode="login"
   host="smtp.gmail.com"
   username="fabien.po...
<parameters>



        <parameter key="swiftmailer.class">Swift_Mailer</parameter>
  <parameter key="swiftmailer.transpor...
Creating DIC extensions
   is insanely simple
Very Fast
  thanks to a Smart
 Caching mechanism
it always knows when to flush the cache
/**
  * Gets the 'swiftmailer.mailer' service.
  *
  * This service is shared.
  * This method always returns the same ins...
The DIC can manage
ANY PHP object (POPO)
Plugins…
or Bundles
Plugins are first-class citizens
   They are called Bundles
Everything is a bundle
       Core features
     Third-party code
     Application code
app/
src/
web/
app/
  AppKernel.php
  cache/
  config/
  console
  logs/
src/
  autoload.php
  Application/
  Bundle/
  vendor/
     doctrine/
     swiftmailer/
     symfony/
     zend/
web/
  index.php
  index_dev.php
.../
  SomeBundle/
     Bundle.php
     Controller/
     Model/
     Resources/
       config/
       views/
public function registerBundleDirs()
{
  return array(
     'Application'        => __DIR__.'/../src/Application',
     'B...
$this->render('SomeBundle:Hello:index', $params)
hello:
  pattern: /hello/:name
  defaults: { _bundle: SomeBundle, ... }
SomeBundle can be any of


ApplicationSomeBundle
BundleSomeBundle
SymfonyFrameworkSomeBundle
Less concepts…
but more powerful ones
symfony 1 View Layer
         templates
           layouts
             slots
        components
           partials
     ...
Symfony 2 View Layer

       templates
         slots
A layout is just another template with _content as a special slot

A partial is just a template you embed in another one

...
<?php $view->output('BlogBundle:Post:list', array('posts'
=> $posts)) ?>
<?php $view->actions->output('BlogBundle:Post:list', array
('limit' => 2)) ?>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html;
charset=utf-8" />
  </head>
  <body>
    <?php $vi...
Big and Small
Improvements
multiple level of layouts
partials can be decorated!
Better
 Logs
INFO: Matched route "blog_home" (parameters: array ( '_bundle' =>
'BlogBundle', '_controller' => 'Post', '_action' => 'ind...
INFO: Matched route "blog_post" (parameters: array ( '_bundle' =>
'BlogBundle', '_controller' => 'Post', '_action' => 'sho...
<zend:logger priority="debug" />
DEBUG: Notifying (until) event "core.request" to listener "(SymfonyFrameworkWebBundleListenerRequestParser, resolve)"
INFO...
Even Better
Exception Error Pages
An Event Better
Web Debug Toolbar
Everything you need is
at the bottom of the screen
Web Designer
 “friendly”
app/
  views/
     BlogBundle/
       Post/
          index.php
     AdminGeneratorBundle/
         DefaultTheme/
        ...
“Mount” Routing
  Configuration
blog:
  resource: BlogBundle/Resources/config/routing.yml

forum:
  resource: ForumBundle/Resources/config/routing.yml
  p...
Symfony 2
is a lazy framework
Smart Autoloading
require_once __DIR__.'/vendor/symfony/src/Symfony/Foundation/UniversalClassLoader.php';

use SymfonyFoundationUniversalCla...
lazy-loading of services
lazy-loading of listeners
lazy-loading of helpers
<?php echo $view->router->generate('blog_post', array('id'
=> $post->getId())) ?>
Symfony 2
is a “cachy” framework
blog/
  cache/
    prod/
      blogProjectContainer.php
      blogUrlGenerator.php
      blogUrlMatcher.php
      classes....
class blogUrlMatcher extends SymfonyComponentsRoutingMatcherUrlMatcher
{
  public function __construct(array $context = ar...
You can use Apache
for Routing matching
A Very Fast
 Dev. Env.
blog/
  cache/
    dev/
      blogProjectContainer.meta
      blogProjectContainer.php
      blogUrlGenerator.meta
      b...
Symfony 2
Easy to learn
   Easy to use
Extensible at will
Easy to learn
 Easy to use
Extensible at will
But Symfony 2 should be slow, right?
Fast as hell
Benchmark
on a simple application
2x faster
   than
Solar 1.0.0
2.5x faster
    than
symfony 1.4.2
3x faster
        than
Zend Framework 1.10
4x faster
   than
 Lithium
6x faster
    than
CakePHP 1.2.6
60x faster
   than
  Flow3
…and Symfony 2.0 uses
    half the memory
needed by both symfony 1 and ZF
We have barely scratched the surface
       of all the goodness of
            Symfony 2.0
Controller                   except for the nice default pages
Autoloading
Cache                        via ZF - DI extens...
Final Release Target Date
      Late 2010
If you want the bleeding edge of news, follow me


         on Twitter @fabpot
    on Github github.com/fabpot
…
http://symfony-reloaded.org/
Questions?
My slides will be available on
http://slideshare.com/fabpot
Sensio S.A.
    92-98, boulevard Victor Hugo
        92 115 Clichy Cedex
              FRANCE
       Tél. : +33 1 40 99 80...
<parameters> <parameter key="swiftmailer.class">Swift_Mailer</parameter> <parameter key="swiftmailer.transport.smtp.class"...
<parameters> <parameter key="swiftmailer.class">Swift_Mailer</parameter> <parameter key="swiftmailer.transport.smtp.class"...
Upcoming SlideShare
Loading in …5
×

<parameters> <parameter key="swiftmailer.class">Swift_Mailer</parameter> <parameter key="swiftmailer.transport.smtp.class">Swift_Transport_EsmtpTransport</parameter> Symfony2 revealed

66,034 views

Published on

<parameters>



<parameter key="swiftmailer.class">Swift_Mailer</parameter>
<parameter key="swiftmailer.transport.smtp.class">Swift_Transport_EsmtpTransport</parameter>

<parameter key="swiftmailer.transport.smtp.host">smtp.gmail.com</parameter>
<parameter key="swiftmailer.transport.smtp.port">25</parameter>
<parameter key="swiftmailer.transport.smtp.encryption">ssl</parameter>
<parameter key="swiftmailer.transport.smtp.username">fabien.potencier</parameter>
<parameter key="swiftmailer.transport.smtp.password">xxxxxx</parameter>
<parameter key="swiftmailer.transport.smtp.auth_mode">login</parameter>
<parameter key="swiftmailer.init_file">swift_init.php</parameter>
</parameters>

<services>



<service id="swiftmailer.mailer" class="%swiftmailer.class%">
<argument type="service" id="swiftmailer.transport" />
<file>%swiftmailer.init_file%</file>
</service>
<service id="swiftmailer.transport.smtp" class="%swiftmailer.transport.smtp.class%">
<argument type="service" id="swiftmailer.transport.buffer" />
<argument type="collection">
<argument type="service" id="swiftmailer.transport.authhandler" />
</argument>
<argument type="service" id="swiftmailer.transport.eventdispatcher" />

<call method="setHost"><argument>%swiftmailer.transport.smtp.host%</argument></call>
<call method="setPort"><argument>%swiftmailer.transport.smtp.port%</argument></call>
<call method="setEncryption"><argument>%swiftmailer.transport.smtp.encryption%</argument></call>
<call method="setUsername"><argument>%swiftmailer.transport.smtp.username%</argument></call>
<call method="setPassword"><argument>%swiftmailer.transport.smtp.password%</argument></call>
<call method="setAuthMode"><argument>%swiftmailer.transport.smtp.auth_mode%</argument></call>
</service>

<service id="swiftmailer.transport.buffer" class="Swift_Transport_StreamBuffer">
<argument type="service" id="swiftmailer.transport.replacementfactory" />
</service>

<service id="swiftmailer.transport.authhandler" class="Swift_Transport_Esmtp_AuthHandler">
<argument type="collection">
<argument type="service"><service class="Swift_Transport_Esmtp_Auth_CramMd5Authenticator" /></argument>
<argument type="service"><service class="Swift_Transport_Esmtp_Auth_LoginAuthenticator" /></argument>
<argument type="service"><service class="Swift_Transport_Esmtp_Auth_PlainAuthenticator" /></argument>
</argument>


XML
 
</service>

<service id="swiftmailer.transport.eventdispatcher" class="Swift_Events_SimpleEventDispatcher" />

<service id="swiftmailer.transport.replacementfactory" class="Swift_StreamFilters_StringReplacementFilterFactory" />

<service id="swiftmailer.transport" alias="swiftmailer.transport.smtp" />
</services>

Published in: Technology
  • Sex in your area is here: ❶❶❶ http://bit.ly/369VOVb ❶❶❶
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Dating direct: ❤❤❤ http://bit.ly/369VOVb ❤❤❤
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (Unlimited) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://soo.gd/qURD } ......................................................................................................................... Download Full EPUB Ebook here { https://soo.gd/qURD } ......................................................................................................................... Download Full doc Ebook here { https://soo.gd/qURD } ......................................................................................................................... Download PDF EBOOK here { https://soo.gd/qURD } ......................................................................................................................... Download EPUB Ebook here { https://soo.gd/qURD } ......................................................................................................................... Download doc Ebook here { https://soo.gd/qURD } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book THIS can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer THIS is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story THIS Helped Ignite a Movement,-- Atomic Habits: An Easy &amp; Proven Way to Build Good Habits &amp; Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money THIS the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths THIS Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • accessibility Books Library allowing access to top content, including thousands of title from favorite author, plus the ability to read or download a huge selection of books for your pc or smartphone within minutes.........ACCESS WEBSITE Over for All Ebooks ..... (Unlimited) ......................................................................................................................... Download FULL PDF EBOOK here { https://urlzs.com/UABbn } .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (Unlimited) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { http://bit.ly/2m77EgH } ......................................................................................................................... Download Full EPUB Ebook here { http://bit.ly/2m77EgH } ......................................................................................................................... ACCESS WEBSITE for All Ebooks ......................................................................................................................... Download Full PDF EBOOK here { http://bit.ly/2m77EgH } ......................................................................................................................... Download EPUB Ebook here { http://bit.ly/2m77EgH } ......................................................................................................................... Download doc Ebook here { http://bit.ly/2m77EgH } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

×