I-Am-Bot Code, technology and life

18Jul/096

Why Symfony is THE PHP Framework to work with

I've spent the last few days fruitfully, searching and comparing the most popular and promising of PHP frameworks. Before I get started, I know the automatic follow up will be PHP bashing, and hailing RoR as the savior of the world. This post isn't about a rails vs PHP comparison, though I intend to write on that shortly.

Anyone looking for a complete PHP framework will have definitely stumbled across these four major options

  • Zend - The original PHP framework that started it all (Apparently CakePHP came earlier than Zend)
  • Cake PHP - Easy and light with support for both PHP 4.1+ and PHP 5+
  • Codeigniter - Relatively new lightweight framework
  • Symfony - Rails inspired, comprehensive

Although there are many more frameworks out there in the wild, these are the most popular and actively developed. As you guessed, this post is about Symfony and why I think its the best. Calling something "the best" is sure to draw a lot of fire from all quarters, so I'll omit it hereon

The Good:

  • Feature Rich - Has all the features one expects from a RAD framework - MVC design pattern, ORM tools, scaffolding, caching, authentication, internalization and localization
  • Actively Developed - The team not only works on the framework, it also incorporates suggestions/enhancements from community members
  • Extensive Plugin Repository - It has 647 plugins from 283 contributors
  • Amazing Documentation - I can't stress on this enough. Documentation makes ALL the difference when you are spoilt for choice. In addition to the complete API reference, you have "The Book" which is a complete reference to learn Symfony step by step. Then there are the real world examples - Jobeet.com tutorial which guides you in making a Complete working website in 24 days (1 hour a day). And yes, you can check out the site here
    Then, you have the customary "Create a blog in 1 hour" tutorial, and another one that makes the admin interface
  • Flexible - There are always two ways to do something using Symfony. For ORM, you have doctrine and propel. For javascript you can use prototype(inbuilt), jQuery or Mootools. Supports XCache, eAccelerator, APC , Memcached for caching.
  • Automatic Admin Generation - Borrowed from Rails, this module makes it a breeze to generate a optimized and fully functional CRUD interface for your applications. And yes, it does work perfectly well
  • Extensive developer tools - Symfony supports three deployment environments, along with very good developer tools that lets you configure, debug and monitor your application performance from the web page itself.
  • Integrated Testing Framework - The "Lime" toolkit allows for unit and functional tests to be written and executed with minimal fuss
  • Rails Inspired - Need I say more?

The Not So Good:

  • It is NOT a small and light framework. But I don't think you can consider 20 MB too large these days, comparing with RoR
  • Learning Curve - Don't use it if you want to finish your application yesterday. It takes time to learn how to use it, due to its strict adherence to coding standards and quality. If you are an experience programmer though, you will find it easier
  • Needs optimization - Even though it isn't a pain to optimize unlike RoR, it still needs some work like setting up caching, and using Memcached for database objects if you want to deploy a real world application on it. But then good documentation is available for that too
  • Its NOT for everyone - This is general to all frameworks. No framework, RoR included, is a "one-size-fits-all" deal. So before you decide to take the plunge, design your application, and put considerable time into thinking if you really need a framework. If all you need is a standard blogging engine, or a normal website with a couple of dynamic scripts, ANY framework in ANY language will be an overkill.

If you can live with the above three points, then Symfony is for you. Even though I'm a complete beginner, I've started to love Symfony. I'm sure you will too, if you look at it objectively. So install it, learn it and have fun!

Edit: Found another great post - http://www.mellowmorning.com/2007/08/18/ten-reasons-why-symfony-rocks-part-1/

About Srinath

No description. Please complete your profile.
Comments (6) Trackbacks (2)
  1. This is a good article, but Zend Framework did not start it all. In fact, it was one of the later frameworks.

  2. Symfony is a great framework. The community is great, but is still in it’s infancy. No doubt, in time it will grow to be as rich as the rails and drupal communities. Glad to have you aboard!

  3. @Pablo, sorry for the mistake. If someone can point out which was indeed the first one, I’ll update the article

    @Brent, I already feel Symfony has a great community and very good documentation. It can only get better :)

  4. I did this comparison of Zend Framework and Symfony.
    http://www.robertspeer.com/blog/symfony-refactor-of-the-zend-quick-start-tutorial/

    The rails-inspired comment is not exactly correct because Symfony is inspired by it’s developers as well as several other projects like: Django & Spring.
    http://www.symfony-project.org/blog/2008/09/23/open-source-cross-pollination

  5. Comparing the major MVC frameworks, CakePHP was around publicly years before the others. It came shortly after RoR was out, originally built by Michael (I forget his last name). If anything, I believe CakePHP “started it all” for PHP MVC frameworks. Zend was the latest offer of the four.

    They’re all based-on or inspired-by Rails, which has it’s own inspirations. I wouldn’t really rank them in any such manner.

  6. @Paul, thanks for pointing that out. I’ll update the article with the correct details. And I didn’t rank the four in any order, just mentioned the four biggest/well known ones.


Leave a comment