As part of the first project I’m taking on at Fundable, I’ve evaluated a wide range of PHP frameworks. From CakePHP to Zend, I completed the feature/checkbox table, reviewed code within each one, moved on to finalist selections, ran a couple sample projects, and finally made the pick.
#1 Features and Support
Within the features and support phase, I was able to break down the frameworks into three categories – Legacy, Established, and Up-and-Comers. I’m sure someone can nit-pick my classifications, but as someone who’s seen web frameworks come and go over the 15+ years, I’m confident that I’m not too far off.
The legacy group contains those that have a mature core codebase and have been in production for a number of years with a significant number of sites. Any of these frameworks would be a safe choice, but at the cost of the latest language features being absent.
CodeIgniter – As the base for ExpressionEngine, CI is a stable platform and is currently compatible with older versions of PHP (5.x). It has a number of developers via it’s “reactor” program and is wide use by the PHP community.
CakePHP – They are eder statesmen as a project that was started in 2005 and stuck to their primary inspiration of Ruby on Rails. While the framework is still being developed, it has largely fallen out of favor to the newer options.
The established options are those that are in wide use, have an active community, tested codebase, and are frequently chosen for new sites. The established players may be starting to slow down on new language support and clinging onto older PHP version support that other frameworks have chosen to drop (or newer frameworks don’t support out of the gate).
Zend Framework – As the 800 pound gorilla of PHP frameworks, Zend does nearly everything and has the weight to show for it. Many stores and commercial projects are built on top of it, it’s well tested, and constantly being updated. Other than the size, and the processing and memory required, it has few downsides.
Kohana – Beginning CodeIgniter inspired, they began when CodeIgniter clung to PHP4 support. Kohana stays current to new futures, but falls prey to a common issue to software projects – documentation. Saying it’s lacking is gentle. Saying it’s woefully missing is more accurate.
Yii – This framework has consistently flown under the radar but, it’s a solid, small framework for a number of common tasks and it takes advantage of its PHP 5.3+ requirements.
Symfony – This framework has a number of solid third-party libraries in use, such as PHPUnit (testing), SwiftMailer (email), and Twig (templates). They have a quality core, and things are extremely configurable.
The Up-and-comers have come into adoption within the last year or two, embrace new PHP features, have a large amount of active development, and energetic team.
FuelPHP – The team took a number of ideas from CodeIgniter, as well as a handful of other frameworks to create a lighter and more modular option. It has good documentation and a number of CodeIgniter developers have migrated onto the framework.
Laravel -This framework has been around for a while, but seems to have really taken off in version 3, and is being largely remodeled for the upcoming version. While initially heavily inspired by CodeIgniter and a handful of other frameworks, it’s now significantly different in its approach.
#2 Reviewing Code
Beyond the feature matrix, I took a look inside the codebase for a number of the options. I looked at the legibility, complexity, and structure of the code, as well as organizational structure of a base project.
I quickly found a theme in folder structure, though many had their own terminology. The idea of “Application/App” and “System/<framework name>/etc” found it’s way into most of the frameworks.
#3 Thinning Out the Pack
I selected CodeIgniter, FuelPHP, and Laravel for further evaluation. While there were numerous items that factored into this, I’ll cover a few of them here.
The common folder structure that I’ve previously mentioned came into play here. Each of the selected frameworks logically separate code in a way that really helps out on a larger project.
Support for Bundles and Modules
Modularity and compatibility for outside libraries was a must. While I can appreciate a lightweight framework, it must also easily integrate with other code. No significant site exists in a vacum. A project might call for a API call to MailChimp, SendGrid, Vimeo, Facebook, Amazon, etc.
Size of Codebase
While surely feature rich, a iceberg sized framework can put undue processing cycles and memory into your monthly hosting bill (no .Net fanboys here). Obviously this metric must be balanced with the feature set and project requirements, but we can find a healthy compromise. Sorry Zend, this is your exit.
#4 Sample Projects
I continued on to create sample projects for FuelPHP and Laravel. I had a recent CodeIgniter project on hand, so I skipped creating a new project for now. In creating these projects, I found myself impressed with both. PHP frameworks have come a long way in the last 5 years. I couldn’t knock either in a major way, though I did find the module (“bundles”) availability better in Laravel.
#5 Final Selection
In the end it really came down to FuelPHP vs Laravel. As CodeIgniter is primarily an EllisLab project, I don’t have faith that it’ll move at the pace needed for the lifespan of our projects. Not an indictment of the current state, but of the outlook of things to come.
When I looked harder at the communities and momentum of each framework a difference emerged. Laravel is the clear winner here. While they are talking about PSR-2 compatibility, and embracing the Composer system with 3rd party components, FuelPHP is behind. In the end, the team behind Laravel is stronger and moving more rapidly to both stay up to date and push boundaries.
I want to make sure I’m clear here. I found both FuelPHP and Laravel sample projects to be great examples of what a PHP framework can be – something that assists, speeds up, and standardizes the development, while not getting in the way (too much). If I was to come into an existing situation with either one, I feel like it would be a productive result.
With all things said, here are some resources for Laravel should you find yourself making the same selection as I did.
- My Introduction to Laravel Slidedeck
- Laravel Forums
- Laravel Twitter
- Laravel IRC
- Laravel on stackoverflow