Why I Switched to Symfony 2 Framework

I have been working with the Zend Framework for the last 3 years. I like it. It is flexible, heavily object oriented, and organized. However, one thing that has always bothered me is that modules in ZF have been second-class citizens. Granted, in Zend Framework 2 this is not the case, but I needed to start a project right away, and since ZF2 is still in beta, I decided to go checkout some other frameworks again.

It has been a while since I looked at different PHP frameworks and I was plesently surprised by the maturity of many of them. Ultimately, though, I was most impressed with Symfony 2 (SF2). Here are some reasons why:

1. Modules (Bundles)

I am a sucker for modules. For some reason I like the idea of being able to create a small library of code, with all the corresponding models/views/controllers, and then being able to drop it any application and have it work (some say I should switch to Python, which inherently works this way). It would mean all sorts of portability for my code. Symfony2 has this ability in the form of Bundles. I started using them this week, and I fell in love. Did I mention there is already a big library of bundles that you can drop in your application? This is the future of PHP development.

2. Defining Routing Using Annotations

Symfony2 allows you to add Annotations (doc blocks) to controller actions that tell the application when to route to this action. You can put any regular expression pattern to match the URL. For some reason this seems so much more elegant than creating a separate routing file.

3. Community

Some of my favorite developers are big contributors to the symfony project. Also, it is the number 1 watched PHP project on GitHub. That is saying something.

4. Documentation � Learning Curve

Zend Framework has a pretty steep learning curve and the documentation does not support beginners very well (although I know they want to remedy this for ZF2).Symfony, however, has a great getting started guide and a great online book to help you get going. It has been so easy to get started that it was hard not to smile.

 

It has only been a week, but I am loving Symfony2. I keep running into new things that make me love SF2 more and more. I’m sure the honeymoon won’t last forever, though, so I’ll of course be posting more on this as I run into issues, find out the negatives, and have more comments in general. Let me know if you like Symfony or prefer something else.

Update: I found another great link that is helpful if you are looking to use Symfony2 for your next project – **How OpenSky chose Symfony as their framework

**