Gen AI in Business - Global Trends Report 2024.pdf
Introduction to symfony2
1. Introduction to
by Pablo Godel
Jan 11 2012 - South Florida PHP Users Group
Wednesday, January 11, 2012
2. 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
5. 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
6. symfony 1.0
released on January 2007
“symfony is a full-stack framework, a library
of cohesive classes written in PHP”
- 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.
Wednesday, January 11, 2012
10. symfony 1.0
Highlights - Command Line Interface
Wednesday, January 11, 2012
11. symfony 1.0
Highlights - Documentation
- A Gentle Introduction to symfony
- Practical symfony (jobeet tutorial)
- The symfony Reference Book
- More with symfony
- The API documentation
http://www.symfony-project.org/doc/1_4/
Wednesday, January 11, 2012
12. symfony 1.0
Highlights - Awesome Community
IRC #symfony & #symfony-devs
Google Groups
symfony-users http://groups.google.com/group/symfony-users
symfony-devs http://groups.google.com/group/symfony-devs
symfony-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
Wednesday, January 11, 2012
13. symfony 1.0
Highlights - Plugins
Wednesday, January 11, 2012
14. symfony 1 vs. Symfony 2
Same philosophy
Rewritten from scratch
Wednesday, January 11, 2012
15. symfony 1 vs. Symfony 2
symfony 1 != Symfony2
Wednesday, January 11, 2012
16. symfony 1 vs. Symfony 2
If you used symfony 1.x
better forget about it.
Wednesday, January 11, 2012
17. 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
18. Symfony 2
21 High Quality
Components
Wednesday, January 11, 2012
19. Symfony 2 Components
• DependencyInjection • Serializer
• EventDispatcher • Validator
• HttpFoundation • Security
• DomCrawler • Routing
• ClassLoader • Console
• CssSelector • Process
• HttpKernel • Config
• BrowserKit • Finder
• Templating • Locale
• Translation • Yaml
• Serializer • Form
All of them at GitHub: http://github.com/symfony
Wednesday, January 11, 2012
20. Symfony 2 Components
Components Documentation
http://symfony.com/doc/current/components/index.html
Blog post series about creating a framework based on
the Symfony2 Components
http://fabien.potencier.org/
Wednesday, January 11, 2012
21. Symfony 2
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
Wednesday, January 11, 2012
22. Symfony 2
Highlights
• 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
Wednesday, January 11, 2012
23. Symfony 2
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
Wednesday, January 11, 2012
25. Symfony 2
Highlights - Bundles
Wednesday, January 11, 2012
26. Symfony 2
Getting Started
http://symfony.com/download
Wednesday, January 11, 2012
27. Symfony 2
Getting Started
tar zxf Symfony_Standard_Vendors_2.0.9.tgz
or
unzip Symfony_Standard_Vendors_2.0.9.zip
Wednesday, January 11, 2012
28. Symfony 2
Getting Started
Distributions
A Symfony distribution is made up of Symfony2
components, a selection of bundles,
a directory structure, a default configuration.
http://symfony.com/distributions
Wednesday, January 11, 2012
29. Symfony 2
Getting Started
Symfony Standard Distribution
• Directory structure
• Default configuration
• Bundles
⁃ DoctrineBundle
⁃ JMSSecurityExtraBundle
⁃ SensioDistributionBundle
⁃ SensioFrameworkExtraBundle
⁃ SensioGeneratorBundle
⁃ AsseticBundle
http://symfony.com/distributions
Wednesday, January 11, 2012
30. Symfony 2
Getting Started
Wednesday, January 11, 2012
31. Symfony 2
Getting Started
Wednesday, January 11, 2012
32. Symfony 2
Directory Structure
Wednesday, January 11, 2012
33. Symfony 2
Directory Structure
Wednesday, January 11, 2012
34. Symfony 2
Directory Structure
Wednesday, January 11, 2012
35. Symfony 2
Directory Structure
Wednesday, January 11, 2012
47. Templating / Twig
Comments:
{# comments are not rendered #}
{# multi-line comments!
{{ var }}
#}
Output variables:
{{ var }}
{{ var | upper }}
{{ var | raw }}
{{ object.property }}
{{ true ? ‘yes’ : ‘no’ }}
http://twig.sensiolabs.org/
Wednesday, January 11, 2012
48. Templating / Twig
Blocks:
{% set var = ‘hello’ %}
{% set foo = var ~ ’ and goodbye’ %}
{% if foo is ‘bar’ %}
...
{% else %}
...
{% endif %}
http://twig.sensiolabs.org/
Wednesday, January 11, 2012
49. Templating / Twig
Blocks:
{% for key, val in list %}
{{ loop.index }}. {{ val }}
{% else %}
No keys.
{% endfor %}
http://twig.sensiolabs.org/
Wednesday, January 11, 2012
51. Awesome Twig Presentations
Twig, The Flexible, Fast and Secure Template Language
for PHP - Fabien Potencier
http://www.slideshare.net/fabpot/twig-the-flexible-fast-and-securetemplate-
language-for-php
Being Dangerous with Twig - Ryan Weaver
http://slideshare.net/weaverryan/being-dangerous-with-twig-symfony-
live-paris
Twig avanzado - Javier Eguiluz
http://www.slideshare.net/javier.eguiluz/twig-avanzado-sf2vigo (Spanish)
Wednesday, January 11, 2012