Killing the magicMany 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.
Learning curveSymfony 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 ContainerWhole 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.
View LayerIn 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 speedAll 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
Always the bestSymfony 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.
It’s public!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).