February 15, 2013 READBY Tanya

A Developers vision

What is Symfony?

Symfony is a bunch of stand alone PHP libraries


What is Symfony2 Framework?

  • A set of bundles containing configuration and bridge classes
  • These glue the components together, giving the developer a consistent experience
  • Symfony 2 is a PHP Framework for web development
  • Symfony 2 is MVC
  • Symfony 2 is OOP
  • Symfony 2 is not Symfony 1 (>=PHP 5.3)
  • Symfony 2 is HTTP-centric
  • Symfony 2 is like bits of Rails and like bits of Java

Why Symfony2?

Based on project needs Symfony can be used as:
  • Full framework
    1. Micro framework (single file apps)
    2. Symfony Components (stand alone)
  • Symfony comes with tight integration with many open source projects like Monolog, Assetic, Doctrine, Propel.
  • Powerful and easy routing.
  • Very advanced and useful template engine TWIG

Symfony2 VS Zend:

  • After the launch of Zend framework 2 (ZF2) all the major things offered in Symfony2 are available in ZF2
  • Both Symfony2 and ZF2 are the next generation frameworks using PHP 5.3
  • Symfony have pre integrated Twig template engine where as now ZF2 comes up with ZfcTwig Modules to support Twig
  • Symfony2 and ZF2 are both good for enterprise products

Things You should Know before starting with Symfony2:

  • Namespaces in PHP
  • YML
  • ORM ( Object relationship Model )
  • Understanding of design Patterns
  • OOP concepts

What can you expect?

22 High quality Components 

  • DependencyInjection          EventDispatcher
  • HttpFoundation                      DomCrawler
  • ClassLoader                              CssSelector
  • HttpKernel                                BrowserKit
  • Templating                                Translation
  • SerializerAl                               Serializer
  • Validator                                   Security
  • Routing                                       Console
  • Process                                       Config
  • Finder                                         Locale
  • Yaml                                            Form

Highlights of Symfony 2:

  • Rewritten from scratch for PHP5.3
  • Based on the HTTP specification
  • Very stable and solid API ( 12 preview releases, 5 beta releases, 6 release candidates, 9 stable releases )
  • Extensible through the creation of Bundles ( replacement for sf1plugins )
  • Flexible configuration using YAML, XML, annotations or PHP
  • All configuration is compiled to PHP code and cached
  • Lots of unit tests
  • Source code audited by independent security firm thanks to donations of the Symfony Community
  • Extensible Configuration with Service Container / Dependency Injection
  • Complete redesign of Forms support
  • Validations
  • Extensible Security with Authentication / Authorization
  • Advanced and powerful templating through Twig
  • Routes configured with YAML, XML or Annotations
  • ESI Caching support out of the box
  • Assets management with Assetic
  • Translations
  • Environments

What are Bundles?

  • Bundle is like a plugin, except that even the core framework is implemented as bundle.
  • Your code is an equal citizen with the core

Symfony2 is a set of standalone PHP component libraries, glued together by a group of removable “bundles” 

Let’s get into some action..

  • Download Symfony2 from http://symfony.com/download
  • Unzip it into your localhost
  • Run the config file http://localhost/Symfony/web/config.php
  • This page identifies any problem with your setup
  • If you want to configure your setup using GUI then click on “Configure your Symfony Application Online”
  • Else you can directly edit Symfony/app/config/parameters.yml

Let’s create some pages..

The 3 step approach:

  • Request comes in – Symfony matches the URL to a route
  • Symfony executes the controller (PHP function) of the route
  • The controller (your code) returns a Symfony Response object

Leave a Reply

Your email address will not be published. Required fields are marked *