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/