I’ve recently been looking at PHP frameworks (namely symfony, CakePHP, and CodeIgniter). Frameworks provide a solid structure for code and to save us from rewriting the same functions and “reinventing the wheel” all over again.
Symfony is probably the most complete framework in terms of features and documentation. CodeIgniter is on the other end of the spectrum and would be well-suited for smaller applications. CakePHP is, in many ways, a perfect mix of the two.
But after reading several blogs, message boards, presentations, and doing each framework’s tutorial, I concluded that there was no clear-cut winner–each framework comes with its own pros and cons–it truly depends on how you plan to use the framework and the complexity of the application.
Ian Clifton’s comment about symfony vs. CodeIgniter summed it up best:
These are really two very different frameworks. If you are doing a massive project, particularly one that needs to scale well, symfony is the answer. If you’re making a personal site and looking to have some nice libraries while organizing your code, CodeIgniter is the way to go. Anything in between just depends. CodeIgniter is extremely easy to learn because it is so intuitive, but it is also much smaller and less feature-rich. symfony is the exact opposite: tough learning curve but features galore.
So here are the frameworks with a description from their respective websites and a compiled list of pros and cons:
symfony
Based on the best practices of web development, thoroughly tried on several active websites, symfony aims to speed up the creation and maintenance of web applications, and to replace the repetitive coding tasks by power, control and pleasure.
Symfony provides a lot of features seamlessly integrated together, such as:
- simple templating and helpers
- cache management
- smart URLs
- scaffolding
- multilingualism and I18N support
- object model and MVC separation
- Ajax support
- enterprise ready
Pros
- Fully-featured framework
- ORM (Propel or Doctrine)
- Admin Generator – prebuilt CRUD forms
- Full native internationalization support
- Supports layouts, templates, components
- Excellent documentation
- Active community
- Automatically creates production/development environments
- Great debugging toolbar
Cons
- PHP5 only
- Many extra features which may not be useful to all developers
- Steep learning curve
- Most tasks tend to be more complicated than other frameworks
- Confusing directory structure
- Uses too many configuration files; not suitable for smaller projects
- Generally perceived as one of the slowest frameworks
- But real-world performance should be fine (caching)
CakePHP
CakePHP is a rapid development framework for PHP which uses commonly known design patterns like ActiveRecord, Association Data Mapping, Front Controller and MVC.
- No Configuration – Set-up the database and let the magic begin
- Extremely Simple – Just look at the name…It’s Cake
- Active, Friendly Community – Join us #cakephp on IRC. We’d love to help you get started.
- Flexible License – Distributed under the MIT License
- Clean IP – Every line of code was written by the CakePHP development team
- Best Practices – covering security, authentication, and session handling, among the many other features.
- OO – Whether you are a seasoned object-oriented programmer or a beginner, you’ll feel comfortable
Pros
- Lightweight, not bloated, containing only essential code
- Very easy to install – hardly any configuration needed
- Extended table association support
- Huge library of components and plug-ins — install only what you need
- Very active community
Cons
- Documentation needs improvement — too much combing through API docs
- Very strict naming conventions
- Feels at times a bit too “black box” — might be hard to follow what’s going on
CodeIgniter
CodeIgniter is a powerful PHP framework with a very small footprint, built for PHP coders who need a simple and elegant toolkit to create full-featured web applications. If you’re a developer who lives in the real world of shared hosting accounts and clients with deadlines, and if you’re tired of ponderously large and thoroughly undocumented frameworks
CodeIgniter is right for you if…
- You want a framework with a small footprint.
- You need exceptional performance.
- You need broad compatibility with standard hosting accounts that run a variety of PHP versions and configurations.
- You want a framework that requires nearly zero configuration.
- You want a framework that does not require you to use the command line.
- You want a framework that does not require you to adhere to restrictive coding rules.
Pros
- Extremely easy to install (zero configuration)
- Extremely lightweight
- Intuitive directory structure
- Does not enforce strong MVC patterns
- One of the fastest performing frameworks
- Good but sparse documentation
Cons
- Lacks some of the modules/libraries other frameworks include (although plug-ins might be available)
- No ORM – does not seem to support table associations
- No written tutorials (only screencasts)
Links
http://www.thecredence.com/php-frameworks-which-one-is-most-suitable-for-you/
http://www.h3rald.com/articles/view/rails-inspired-php-frameworks
http://www.phphacks.com/content/view/53/33/
http://www.phpit.net/demo/framework%20comparison/chart.php
http://www.keyboardcowboy.co.uk/2007/10/16/php-and-symfony/
http://www.keyboardcowboy.co.uk/2007/10/13/php-and-cakephp/
http://www.keyboardcowboy.co.uk/2007/10/17/php-and-codeigniter/
http://www.devtrench.com/codeigniter-vs-symfony/
http://snook.ca/archives/php/codeigniter_vs_cakephp/
http://www.zenperfect.com/2007/07/15/faceoff-codeigniter-vs-cakephp/
http://cake.insertdesignhere.com/files/nyphp_presentation.pdf
http://www.slideshare.net/dustin.whittle/diving-into-symfony-2007
http://www.slideshare.net/patter/symfony-on-action-webtech-207
http://www.slideshare.net/guest193fe1/cake-php-12-ocphp



In addition, if you were to choose a framework for PHP projects that you’ve already done, which framework would be most useful/appropriate?
If the answer is different for each one, which framework is the best compromise such that we can commit to a single one?
Hey Jon,
Thanks for detailing this. I have one question.
In your memory of our Java stack with it’s framework. Can you compare each of these frameworks to our Java development, particularly in terms of learning curve and being able to solve problems?
Excellent post.
CodeIgniter is licensed under an Apache/BSD license, and Symfony, like Cake, is also licensed under an MIT style license.
So these should all be OK to use from a licensing perspective.