Upload
mohammed-irfan
View
67
Download
8
Embed Size (px)
DESCRIPTION
Brief introduction to Symfony 2 framework
Citation preview
Introduction to
by Pablo Godel Jan 11 2012 - South Florida PHP Users Group
Wednesday, January 11, 2012
Who Am I?
⁃ Born in Argentina, living in the US since 1999⁃ PHP & Symfony developer⁃ Founder of the PHP mailing list in spanish ⁃ Cofounder of ServerGrove Networks⁃ Founded in 2005⁃ provider of web hosting specialized in PHP, Symfony,
ZendFramework among others⁃ Very active open source supporter through code
contributions and usergroups/conference sponsoring
Wednesday, January 11, 2012
Wednesday, January 11, 2012
History of Symfony
Wednesday, January 11, 2012
Releases
- symfony 1.0: January 2007- symfony 1.2: November 2008- symfony 1.4: November 2009
- Symfony 2.0: July 2011- Symfony 2.1: Planned for early 2012
Wednesday, January 11, 2012
symfony 1.0
- Several libraries put together (modified Mojavi, Propel, Prado i18n, etc)
- Concepts borrowed from several languages and frameworks- Routing, CLI, functional tests, YAML, helpers
- One of first PHP frameworks to include a Web Debug Toolbar, and an Admin Generator.
“symfony is a full-stack framework, a library of cohesive classes written in PHP”
released on January 2007
Wednesday, January 11, 2012
- ORM integration: Propel and Doctrine- YAML cascading configuration- Web Debug Toolbar - Admin Generator- Environments- CLI- Functional Tests- Template Caching- Internationalization- Documentation- Plugins- Awesome Community
symfony 1.0Highlights
Wednesday, January 11, 2012
symfony 1.0Highlights - Web Debug Toolbar
Wednesday, January 11, 2012
symfony 1.0Highlights - Admin Generator
Wednesday, January 11, 2012
symfony 1.0Highlights - Command Line Interface
Wednesday, January 11, 2012
- A Gentle Introduction to symfony- Practical symfony (jobeet tutorial)- The symfony Reference Book- More with symfony- The API documentation
symfony 1.0Highlights - Documentation
http://www.symfony-project.org/doc/1_4/
Wednesday, January 11, 2012
IRC #symfony & #symfony-devs
Google Groupssymfony-users http://groups.google.com/group/symfony-userssymfony-devs http://groups.google.com/group/symfony-devssymfony-es http://groups.google.com/group/symfony-es
Wiki http://trac.symfony-project.org/wiki/
Forums http://forum.symfony-project.org/
Lots of Blogs
Conferences around the world: US, France, Germany, Spain
symfony 1.0Highlights - Awesome Community
Wednesday, January 11, 2012
symfony 1.0Highlights - Plugins
Wednesday, January 11, 2012
symfony 1 vs. Symfony 2
Same philosophy
Rewritten from scratch
Wednesday, January 11, 2012
symfony 1 vs. Symfony 2
symfony 1 != Symfony2
Wednesday, January 11, 2012
If you used symfony 1.x
better forget about it.
symfony 1 vs. Symfony 2
Wednesday, January 11, 2012
Symfony 2
“First, Symfony2 is a reusable set of standalone, decoupled, and cohesive PHP components that solve common web
development problems.Then, based on these components, Symfony2 is also a
full-stack web framework.”
http://fabien.potencier.org/article/49/what-is-symfony2
Wednesday, January 11, 2012
21 High Quality Components
Symfony 2
Wednesday, January 11, 2012
• DependencyInjection• EventDispatcher• HttpFoundation• DomCrawler• ClassLoader• CssSelector• HttpKernel• BrowserKit• Templating• Translation• Serializer
All of them at GitHub: http://github.com/symfony
• Serializer• Validator • Security • Routing • Console • Process • Config • Finder • Locale • Yaml• Form
Symfony 2 Components
Wednesday, January 11, 2012
Symfony 2 Components
http://symfony.com/doc/current/components/index.html
http://fabien.potencier.org/
Components Documentation
Blog post series about creating a framework based on the Symfony2 Components
Wednesday, January 11, 2012
Highlights
• Rewritten from scratch for PHP 5.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
sf1 plugins)• 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
Symfony 2
Wednesday, January 11, 2012
• 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
Symfony 2Highlights
Wednesday, January 11, 2012
Community
• 357 developers contributed to Symfony2• 3000+ pull requests• 969 977 bundles at knpbundles.com• Same very active IRC and mailing lists support channels• Community Gamification through SensioLabs Connect• Symfony2 Ecosystem
Symfony 2
Wednesday, January 11, 2012
Highlights - SensioLabs ConnectSymfony 2
Wednesday, January 11, 2012
Highlights - BundlesSymfony 2
Wednesday, January 11, 2012
Getting StartedSymfony 2
http://symfony.com/download
Wednesday, January 11, 2012
Getting StartedSymfony 2
or
tar zxf Symfony_Standard_Vendors_2.0.9.tgz
unzip Symfony_Standard_Vendors_2.0.9.zip
Wednesday, January 11, 2012
Getting StartedSymfony 2
Distributions
http://symfony.com/distributions
A Symfony distribution is made up of Symfony2 components, a selection of bundles,
a directory structure, a default configuration.
Wednesday, January 11, 2012
Getting StartedSymfony 2
http://symfony.com/distributions
Symfony Standard Distribution
• Directory structure• Default configuration• Bundles⁃ DoctrineBundle⁃ JMSSecurityExtraBundle⁃ SensioDistributionBundle⁃ SensioFrameworkExtraBundle⁃ SensioGeneratorBundle⁃ AsseticBundle
Wednesday, January 11, 2012
Getting StartedSymfony 2
Wednesday, January 11, 2012
Getting StartedSymfony 2
Wednesday, January 11, 2012
Directory StructureSymfony 2
Wednesday, January 11, 2012
Symfony 2Directory Structure
Wednesday, January 11, 2012
Symfony 2Directory Structure
Wednesday, January 11, 2012
Symfony 2Directory Structure
Wednesday, January 11, 2012
Configuration Files - app/config.ymlSymfony 2
Wednesday, January 11, 2012
Configuration Files - app/parameters.iniSymfony 2
Wednesday, January 11, 2012
Configuration Files - app/config_dev.ymlSymfony 2
Wednesday, January 11, 2012
Browser
Bootstrap (app.php)
Controller
Template
Response
Request
Wednesday, January 11, 2012
Bootstrap (app.php)
Wednesday, January 11, 2012
Bootstrap File - web/app.phpSymfony 2
Wednesday, January 11, 2012
Controllers
Wednesday, January 11, 2012
Controllers
Wednesday, January 11, 2012
Controllers
Wednesday, January 11, 2012
Controllers
Wednesday, January 11, 2012
Templates
Wednesday, January 11, 2012
Templating / Twig
{# comments are not rendered #}
{# multi-line comments! {{ var }}#}
Comments:
Output variables:{{ var }}{{ var | upper }}{{ var | raw }}{{ object.property }}{{ true ? ‘yes’ : ‘no’ }}
http://twig.sensiolabs.org/Wednesday, January 11, 2012
Templating / Twig
{% set var = ‘hello’ %}{% set foo = var ~ ’ and goodbye’ %}
{% if foo is ‘bar’ %}...
{% else %}...
{% endif %}
Blocks:
http://twig.sensiolabs.org/Wednesday, January 11, 2012
Templating / Twig
{% for key, val in list %}
{{ loop.index }}. {{ val }}
{% else %}
No keys.
{% endfor %}
Blocks:
http://twig.sensiolabs.org/Wednesday, January 11, 2012
Templating / Twig
http://twig.sensiolabs.org/
{% include “Bundle:Demo:template.html.twig” %}
Include:
Render:
{% render “Bundle:Demo:action” %}
Extends:
{% extends "Bundle::layout.html.twig" %}
Wednesday, January 11, 2012
Awesome Twig Presentations
http://slideshare.net/weaverryan/being-dangerous-with-twig-symfony-live-paris
http://www.slideshare.net/fabpot/twig-the-flexible-fast-and-securetemplate-language-for-php
http://www.slideshare.net/javier.eguiluz/twig-avanzado-sf2vigo (Spanish)
Twig avanzado - Javier Eguiluz
Being Dangerous with Twig - Ryan Weaver
Twig, The Flexible, Fast and Secure Template Language for PHP - Fabien Potencier
Wednesday, January 11, 2012
layout.html.twigTemplating / Twig
Wednesday, January 11, 2012
index.html.twigTemplating / Twig
Wednesday, January 11, 2012
Templating / Twigindex.html.twig
Wednesday, January 11, 2012
Bundles
Wednesday, January 11, 2012
Bundles
Everything in Symfony2 is contained in Bundles
Wednesday, January 11, 2012
Bundles
Even Symfony2 is a collection of Bundles
Wednesday, January 11, 2012
Symfony 2Directory Structure
Wednesday, January 11, 2012
Bundles Registration - app/AppKernel.phpSymfony 2
Wednesday, January 11, 2012
Bundles Showcase
Wednesday, January 11, 2012
Bundles Showcase
Wednesday, January 11, 2012
Bundles Showcase
Wednesday, January 11, 2012
Bundles Showcase
Wednesday, January 11, 2012
Bundles Showcase
Wednesday, January 11, 2012
And many many more!
Bundles Showcase
Wednesday, January 11, 2012
Forms
Wednesday, January 11, 2012
FormsDefinition
Wednesday, January 11, 2012
FormsPresentation
Wednesday, January 11, 2012
FormsProcessing
Wednesday, January 11, 2012
Web Debug Toolbar&
Profiler
Wednesday, January 11, 2012
Web Debug Toolbar / Profiler
Wednesday, January 11, 2012
CLI, Generator CommandsDemo
Wednesday, January 11, 2012
Ecosystem
Twig Silex
ORM & ODM
Deployments BDD Framework Web Acceptance Testing
Wednesday, January 11, 2012
Who uses Symfony2?
Wednesday, January 11, 2012
Who uses Symfony2?
Wednesday, January 11, 2012
Who uses Symfony2?
Wednesday, January 11, 2012
Who uses Symfony2?
Wednesday, January 11, 2012
Who uses Symfony2?
Wednesday, January 11, 2012
Who uses Symfony2?
Wednesday, January 11, 2012
You?
Wednesday, January 11, 2012
You should :-)
Wednesday, January 11, 2012
Questions?
Wednesday, January 11, 2012
Wednesday, January 11, 2012
Thank you!
Slides: http://slideshare.net/pgodel
Twitter: @pgodelIRC Freenode: pgodel
E-mail: [email protected]
Wednesday, January 11, 2012