For my next project I have decided to use a PHP framework. There are far too many PHP frameworks to evaluate them all carefully, so after a modest look, I narrowed my choices down to CakePHP, CodeIgniter and Yii. One can’t make a good comparison without actually using each framework in a real project, so that’s what I will do. This comparison will have two parts:
- Part 0 is this page. Here I explain by comparison criteria.
- Part I will be my evaluation after reading all the documentation and writing a hello-world application.
Part II will be the result of my experience as I use each framework to write a prototype for my real-world application.Sorry. Part II is cancelled due to lack of time (this kind of article takes a lot of time).
- Project description:
- I want to rewrite a legacy PHP application that has outgrown its design. The application is very database-oriented. Our customers are UK schools and the core of the system is a database with student data (marks (grades), awards, teaching groups, etc).
My Criteria
There is no universal, absolute “best” PHP framework. It depends on your particular needs and preferences. Here is a list of the key things that I will be looking for in selecting a PHP framework. The criteria are not in any particular order:
- Simplicity
- I value simplicity above having every possible feature. I like to understand the tools I use. I certainly don’t mind if the framework has every possible feature, but not at the expense of simplicity.
- Documentation
- I value clarity and organization above documenting every detail. Maybe it’s my background as a teacher and author, but I do set a high standard for documentation. Above all else, I expect it to be clear and well organized.
- Performance
- I value code quality and correctness above speed. Although I will not use a fast but otherwise poor framework, the reality is that for my application performance is a real concern. Thus, I must seriously consider performance in my analysis.
- Flexibility
- I value flexibility above conventions. I have a legacy database that I must use. I am replacing a legacy application that was not well designed. Some of the business logic is a bit complex. I need a tool that can cope with this without making my life difficult.
- Security
- I value security above most things. I take security seriously and I want my tools to be likewise. For example, to avoid SQL Injection attacks, most frameworks are content to simply escape strings so they can support PHP4. I am not satisfied with that. I want good security (prepared statements) and to heck with PHP4.
I never use a real framework with PHP, only a template engine, Smarty. I think it can be useful to switch to a good framework basis for a big project.
Note: The link to Part 2 and 3 are pretty hard to find.
I’d love to hear what you picked and how it went. Any thoughts on this, looking back?
Anyhow, thanks for the great article. It was very well put together and helpful.
Link to Part I