During the first international Symfony Live conference Fabien Potencier introduced Symfony 2. It’s a next generation framework which will change PHP world forever. I already wrote about the highlights of the conference and revealing the Symfony 2 was the most awaited.
It’s only a preview release and first stable version is expected at the end of 2010. Even so the framework already looks very impressive.
Read on to get an overview of all its new and cool features. Symfony finally gets its capital ‘S’!
Killing the magic
Many problems of symfony 1.x was caused by all the magic happening behind the scene. Well, the magic is killed with Symfony 2.
To make the code more readable and decrease learning curve a developer is forced to be explicit. The problem with magic is it’s hard to control and in many cases you just don’t know what happens. Specially if something goes wrong. Being explicit decreases the number of WTFs/m.
Symfony 1.x has one of the most steep learning curves from all the PHP frameworks. It’s powerful but it takes a while to understand it.
It’s possible to grasp the basic idea behind the Symfony 2 in twenty minutes. After one hour you should be able to start coding.
As promising as it sounds I can assure you it’s true. Check it yourself and read Quick Tour.
So what has changed?
Symfony 2 is simple. It’s based only on view concepts. The key is that those concepts are more powerful ones and are reused in several places. Framework is more consistent. Once you learn basics you can later just try ‘guessing’ where the features you’re looking for are placed.
Dependency Injection Container
Whole bunch of symfony 1.x ideas including context, configurations and all configuration handlers were replaced by Dependency Injection Container (available as Symfony Component). It makes configuration very easy and flexible. What’s even more important new concept has a lot smaller footprint.
Bundles (previously known as plugins)
In symfony 1.x plugins were introduced relatively late. They were supposed to be structured like an application for the sake of extensibility. The concept was good but the framework architecture limited it a bit.
In symfony 2 plugins got more attention. They are special, first-class citizens. That’s why they even got a new name. Plugins are now bundles.
In fact everything is a bundle. All code you write or reuse is organized in bundles. This includes core features, third-party and application code.
Bundles can be extended or overridden as many times you want. Notice that also core framework features can be extended. It gives a lot of flexibility.
In symfony 1.x a view layer uses templates, layouts, partials, components, slots and component slots. That’s quite a big set of tools. Can be confusing for less technical guys like designers.
In Symfony 2 view layer is reduced to templates and slots. Of course it’s done without loosing any functionalities. In fact we gain more power and flexibility with such a new features like multiple decoration levels.
Need for speed
All the new concepts (few but powerful) behind next version of Symfony Framework makes it extremely fast.
Simple application benchmark which uses all the common framework features prove that Symfony 2 is:
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
What’s also important Symfony 2 uses half the memory needed by both symfony 1.x and Zend Framework.
Always the best
Symfony 1.x borrowed many existing concepts and solutions from other Open Source projects. It was always about adopting what’s the best out there, then mixing it and adding few unique features.
Symfony 2 continues with this approach. Dependency injection implementation is looked up from Spring framework (Java). Symfony 1.x logger and cache were replaced by Zend Framework classes. Why? Because they are simply better.
During the conference the first version of Symfony 2 was pushed to the git repository on github. You can already download it and test. Just remember that code is under active development and many things can still change. It’s not yet ready for production environment.
Also, Symfony Reloaded website was created to present and teach about the new framework.
Below are the slides and video from the original presentation made on Symfony Live (embedded from vimeo and slideshare).
PHP development manager in GOYELLO, focusing on delivering high quality software with clean and easily maintainable code. Follows best programming practices and use the best Open Source solutions. Big fan of symfony framework.
We process cookies and make them available to Google Analytics (a service provided by Google, Inc.) to improve the performance of the website, to learn your preferences about using it and to tailor it to your needs. The data will be anonymised before being transmitted. If you do not agree to this, you may disable cookies in your browser. If you do not change your browser settings, you accept the fact that it saves cookies.