• Pages

  • May 2010
    M T W T F S S
     12
    3456789
    10111213141516
    17181920212223
    24252627282930
    31  

Comparison Between Zend and CakePHP Framework

A lot of people have been asking for some comparison articles for some of the popular frameworks. Here I found a nice comparison between Zend framework and CakePHP framework from Douglas Brown.

ZF offers a simple component library to provide 80 percent of the functionality mostly needed by developers. The rest of the 20 percent can be altered as per your requirements of the business. This can be done since it has a flexible architecture and you do not need any configuration file to get started with. Due to this, training costs are lessened and the product reaches the market sooner.

CakePHP is a rapid development framework for PHP that offers a flexible architecture for development, maintenance and deployment of applications. It uses the usual design patterns like MVC and ORM within the convention over configuration paradigm that helps lower development expenses and does not need the developers to write a lot of code.

Just like ZF, CakePHP does not require configuration. It is very simple to use. The company has a user friendly community called #cakephp on IRC that helps new users to begin. It is distributed under the MIT License and promises Best Practices like security, authentication and session handling. It has an object-oriented approach to keep you at ease.

Overall, both these frameworks are good to use as per your requirements. CakePHP is suitable for developers new to MVC and those who require stricter conventions. ZF is a choice for those who need better control over the application design and built-in support for renowned Web services. Both the frameworks are developing fast and the choice is entirely yours.

Some of the people noted that CakePHP has poor documentation. The Zend Framework definitely has better documentation. So if you were just getting started using an MVC Framework, ZF would be a good place to start.

Here’s a comparison and a few conclusions after spending a bit of time with both CakePHP and the Zend Framework. Please note that my quality scale range is: poor, fair, good, excellent.

Feature Comparison of CakePHP and the Zend Framework

Feature
CakePHP Zend Framework Notes
License
Each of these licenses is fairly flexible. Carefully consider how your application will be used and distributed. It’s also important to consider compatability with 3rd-party extensions included in your application.
Compatability
4 and 5
5.1.4 or later
I’m curious to know what CakePHP’s PHP 4 support plans are. I would wager that Zend’s focus on PHP 5 provides it with performance advantages.
Documentation
CakePHP’s documentation is good but Zend’s API documentation is more thorough.
Community
Both frameworks have active user communities. In addition to official channels, there are also several 3rd-party community sites easily found through Google. CakePHP has done an excellent job of marketing their framework considering that they don’t have the corporate backing that ZF has.
Tutorial/Sample Availability
excellent
fair
CakePHP’s Bakery provides an extensive collection of user-submitted applications and code samples. The IBM developerWorks CakePHP tutorials and aritcles are excellent. The Zend tutorials I’ve reviewed are good but require a siginifcant amount of MVC design experience. The ZF beginner’s videos, however, are very helpful. CakePHP provides screencasts too.
MVC
strict
optional
These points are the biggest distinctions between these frameworks and probably the most important factors when choosing one over the other. CakePHP has very strict naming and code organization conventions while Zend only enforces conventions when employing its MVC capabilities.
Conventions
strict
flexible
Configuration
PHP file
PHP Array, XML, or

INI files

This difference doesn’t seem like a sticking point to me. If you’re a fan of build tools like ANT, you might prefer Zend’s choice of XML.
Database Abstraction
PHP, PEAR, ADODB
I may be wrong, but I get the impression that PDO is gaining favor in the PHP community.
Security
Both frameworks take security very seriously and provide authentication and ACL-based authorization. Both approach ACLs in a similar fashion and both provide a high degree of flexibility in creating and applying ACLs.
Data

Handling

good
excellent
Out of the box, both frameworks provide data validation and sanitization mechanisms. Zend provides more validation options, but CakePHP’s validation is easily extended via PCRE. CakePHP provides a single data sanitization mechanism where Zend provides various filters to run data through.
Caching
good
excellent
Both provide file-based caching of pages. Zend supports several cache backends, including APC, SqlLite, and of course, the Zend Platform.
Sessions
excellent
excellent
Both provide robust session handling.
Logging/

Debugging

good
excellent
Both provide application logging. IMHO, the Zend_Debug class gives ZF the edge in this category.
Templating
PHP-based
PHP-based
Coming from a UI design background, templating is of particular interest to me. If you’ve developed templates for WordPress or Drupal, you’ll feel right at home with CakePHP. The Zend Framework requires a bit more work to get templating up and running (see Zend_View and Zend_Layout). It’s possible to integrate 3rd party templating engines, like Smarty, with each framework.
Helpers
good
excellent
Both frameworks provide basic helpers to handle AJAX, forms, and time conversions. CakePHP provides a nice HTML helper which is absent in ZF but ZF provides a wider range of helper classes.
JavaScript/Ajax
good
fair
CakePHP comes with built-in support for Prototype and script.aculo.us while the current stable release of the ZF doesn’t support any specific JavaScript framework. ZF does provide JSON support and the 1.5 release adds AJAX form featues. I’d like to see both provide a wider range of support for 3rd party JavaScript Frameworks, particularly Jquery and YUI.
Web Services
good
excellent
Both provide support for REST and XML-RPC as well as basic XML feed parsing. Zend Framework also provides support for several popular web services including OpenID, Reflection, Akismet, Amazon, Audioscrobbler, Delicious, Flickr, Simpy, StrikeIron, Technorati, and Yahoo.
Localization
good
excellent
Both support localization through stadard means (i18n, l10n). CakePHP is adding/improving support in their upcoming 1.2 release. Zend appears to have better support for localization and translation.
Unit Testing
yes
yes
Both frameworks provide support for this feature that far too many of us avoid 😉 I have yet to evaluate unit testing support.

Conclusions and Recommendations

I hope to use both of these frameworks soon, but in the short term I’ll most likely base an upcoming CMS project on CakePHP. I do plan on using the Zend Framework, if for nothing other than expanding my application design skills, PHP 5 OO knowledge, and understanding of MVC.

Zend help:

Websites:
http://framework.zend.com/wiki/display/ZFDEV/Tutorial
http://framework.zend.com/manual/en/ !!
http://www.zftutorials.com/
http://www-128.ibm.com/developerworks/opensource/library/os-php-zend1/

Books:
http://www.zendframeworkinaction.com/
http://www.phparch.com/c/books/id/9780973862157

Is it enough? :)

Leave a comment