3. symfony 1.0 – January 2007
• Started as a glue between existing Open-Source libraries:
– Mojavi (heavily modified), Propel, Prado i18n, …
• Borrowed concepts from other languages and frameworks:
– Routing, CLI, functional tests, YAML, Rails helpers…
• Added new concepts to the mix
– Web Debug Toolbar, admin generator, configuration cascade, …
4. symfony 1.2 – November 2008
• Based on decoupled but cohesive components
– Forms, Routing, Cache, YAML, ORMs, …
• Controller still based on Mojavi
– View, Filter Chain, …
5. symfony 1.4 – November 2009
• Added some polish on existing features
• Removed the support for deprecated features
• Current LTS release, maintained until late 2012
23. <?php Everything is namespaced
namespace ApplicationHelloBundleController;
use SymfonyFrameworkWebBundleController;
class HelloController extends Controller
{
public function indexAction($name) Variables come from the routing
{
return $this->render('HelloBundle:Hello:index', array('name' => $name));
}
}
Template name Variables to pass
to the template
35. Replaces a lot of symfony 1 “things”
sfConfig
All config handlers
sfProjectConfiguration /
sfApplicationConfiguration
sfContext (No Singleton anymore)
The configuration cache system
… and some more
36. in one
easy-to-master
unified
and cohesive package
37. Thanks to the DIC,
Configuration has never been
so easy and so flexible
53. You choose the format you want
Pros Cons
XML validation verbose (not that much)
IDE completion & help
YAML concise needs the YAML component
simple to read no validation
easy to change no IDE auto-completion
PHP flexible no validation
more expressive
62. Very Fast
thanks to a Smart
Caching mechanism
it always knows when to flush the cache
63. /**
* Gets the 'swiftmailer.mailer' service.
*
* This service is shared.
* This method always returns the same instance of the service.
*
* @return Swift_Mailer A Swift_Mailer instance.
PHPDoc for auto-completion
*/
protected function getSwiftmailer_MailerService()
{
if (isset($this->shared['swiftmailer.mailer']))
return $this->shared['swiftmailer.mailer']; As fast as it could be
$instance = new Swift_Mailer($this->getSwiftmailer_Transport_SmtpService());
return $this->shared['swiftmailer.mailer'] = $instance;
}
81. A layout is just another template with _content as a special slot
A partial is just a template you embed in another one
A component is just another action embedded in a template
89. INFO: Matched route "blog_home" (parameters: array ( '_bundle' =>
'BlogBundle', '_controller' => 'Post', '_action' => 'index', '_route' =>
'blog_home',))
INFO: Using controller "BundleBlogBundleController
PostController::indexAction"
INFO: SELECT s0_.id AS id0, s0_.title AS title1, s0_.html_body AS html_body2,
s0_.excerpt AS excerpt3, s0_.published_at AS published_at4 FROM sf_weblog_post
s0_ ORDER BY s0_.published_at DESC LIMIT 10 (array ())
90. INFO: Matched route "blog_post" (parameters: array ( '_bundle' =>
'BlogBundle', '_controller' => 'Post', '_action' => 'show', '_format' =>
'html', 'id' => '3456', '_route' => 'blog_post',))
INFO: Using controller "BundleBlogBundleController
PostController::showAction »
INFO: SELECT s0_.id AS id0, s0_.title AS title1, s0_.html_body AS html_body2,
s0_.excerpt AS excerpt3, s0_.published_at AS published_at4 FROM sf_weblog_post
s0_ WHERE s0_.id = ? (array ( 0 => '3456',))
ERR: Post "3456" not found! (No result was found for query although at least
one row was expected.) (uncaught SymfonyComponentsRequestHandlerException
NotFoundHttpException exception)
INFO: Using controller "SymfonyFrameworkWebBundleController
ExceptionController::exceptionAction"
127. …and Symfony 2.0 uses
half the memory
needed by both symfony 1 and ZF
128. We have barely scratched the surface
of all the goodness of
Symfony 2.0
129. Controller except for the nice default pages
Autoloading
Cache via ZF - DI extension coming soon
CLI commands still missing
Configuration
Database via Doctrine DBAL
Debug except Timer and extended WDT
Escaper
Event Dispatcher
Form / Validation / Widget can use the 1.4 version as is
Admin Generator
Helpers
I18n / L10n can use the 1.4 version as is
Logger via ZF
Mailer except commands
Bundles except installing
Doctrine Plugin just the DBAL part
Propel Plugin
Request / Response
Routing no REST support, no Object support
Storage / User
Test
View