hellorobot.org

Choosing a PHP Framework

The four PHP frameworks I see referenced most in blogs and articles are CakePHP, CodeIgniter, Symphony, and the Zend Framework. In a completely unscientific poll of my memory, CakePHP seems to receive the most praise. But I have some doubts about its usefulness.

To begin my search, I googled “Zend vs CakePHP.” Why only the two of them? I’ve heard rumors previously of Symphony being slow, and I’ve been less than impressed with ExpressionEngine, the do-everything blogging platform created by EllisLab, the same folks behind CodeIgniter. Luckily, searching for Zend and Cake returns plenty of information on all four frameworks.

Chart Comparisons of Features

Some of the results include comparison tables of features, such as this one or this one at Wikipedia. The former chart is outdated; the article was published in 2006 and already differs in significant ways from the more up-to-date chart at Wikipedia. For example, Zend Framework does now include an Object-Record Mapper.

From the charts, I like that Zend and CodeIgniter are based on PHP 5 – I worry that a decision to support PHP 4 is mostly a marketing decision, an effort to increase “audience,” at the potential expense of optimization and performance. Beyond that, there’s not much of a difference, although Cake and Zend both include DB migration support, and I like that their security frameworks are ACL-based.

Benchmarks

Benchmarking as a form of scientific experiment is susceptible to problems of control variables, and therefore, any benchmark results should be considered with skepticism. This report on Paul Jones’ blog favors the Zend Framework (although CakePHP isn’t far behind, and CodeIgniter is not included). Another benchmark test that excluded Zend found a significant lead in CodeIgnitor. That Zend and CakePHP were not far apart in the first, but that CodeIgniter is a clear improvement over Cake in the second, may suggest that CodeIgniter is faster than Zend, too.

What Really Matters in a Framework?

The more I read up on the different frameworks the more reasons I find that people prefer one over another: ease of development; speed and scalability; plug-in architecture and add-on features; quality of documentation… All of it matters, but some, I think, much less: yes, it’s troublesome if a framework has poor documentation and is difficult to development in, but I think the length and slope of the learning curve is especially significant in conjunction with the results of mastery: a violin, for example, is one of the hardest musical instruments to learn, but once mastered, its potential far outstrips almost every other instrument.

Assuming a baseline of functionality – an object-relational mapping to the database, a reliable MVC structure, an authentication class, et cetera – and assuming a baseline of accessibility, where the documentation is detailed at least enough to allow mastery of a framework within a reasonable period of study, I think that frameworks should be evaluated on their maximum potential. A framework should be extensible, transparent, and professional.

Extensible, Transparent, and Professional

By extensible I mean not only that a framework is built to support child classes, or plugins, et cetera, but also that a framework does as little as is possible given the project at hand. One worry I have about CakePHP is its tendency to bake the entire shop before I’ve placed an order.

By transparent I mean that a framework’s inner workings, or behind-the-scenes “magic,” should not appear to be, well, magic. Understanding the underlying architecture and methodologies should not be an insurmountable task. I’m interested in frameworks marketed at professional developers and Enterprise-level projects, not those interested in new-to-the-web novices who want the work done for them.

By professional I mean that a framework should follow standard coding practices where those practices exist and should clearly outline guidelines for its own additional practices. Furthermore, a professional framework is well-supported by an organization or company that is not likely to dissolve soon; and said company or organization will be regularly updating and extending the framework toward usability, not toward marketable feature bloat – the best audience for a professional framework is a professional development audience, not laymen.

Not for N00bs

It’s not that frameworks should be elitist; I would much prefer the best framework also be the one with the best documentation and be the easiest to use. But I believe that an amateur’s procedural PHP is better suited for the growing capabilities of post-blogging platforms, like WordPress and ExpressionEngine. A framework is better suited to a more complex project where the relationships between user and content and data are more project-specific than the standard article-and-comments format that defines most of the Internet.

Like writing an editorial, it’s a matter of audience. If you’re trying to persuade democrats and republicans both simultaneously that your economic stimulus package is the best available, your editorial is going to be unfocused and cluttered. If you select only one party to address, already your essay is going to be more focused and more persuasive. In the case of frameworks, developers are the audience, and programming knowledge is the defining difference between varying groups of developers. A framework that attempts to meet the needs of varying developer skill levels is going to be bloated. The best framework, as defined as extensible, transparent, and professional, will aim for a professional-level audience.

Zend Wins

I wish that I could test all four frameworks, but I don’t have that much time. My instincts after reading blog entries and selling points on their websites is that Zend will most fit my needs over the long run. It markets itself based on what it can do, how can be implemented, not on its ease of implementation.

No Responses

Add your response

Respond to “Choosing a PHP Framework”