Notes on Choosing a PHP Framework: A Comparison of CakePHP and the Zend Framework

UPDATE:Parlez vous Français? Guillaume Rossolini has created a French translation of this article.

Are you considering using a PHP framework for your next project? If so, this article's for you. I've narrowed down my choices to CakePHP and the Zend Framework and have documented my findings here.

Four or five years ago I began researching PHP application frameworks. At the time, the pickings were very slim, especially when compared to those available to Java developers. On the advice of an ex-Coldfusion developer, I settled on the PHP port of Fusebox, the de facto Coldfusion framework. Fusebox 3 provided a convenient set of loose conventions for structuring applications, organizing code, naming files, and controlling flow. It served my development team well and applications we built with it are still up and running.

I took a two-year "break" from development and upon my return I found more PHP frameworks than you can shake a stick at. Now I need to find a solid MVC-based framework and after reading dozens of articles and completing a few tutorials, I've narrowed my focus to CakePHP and the Zend Framework.

Before going further, let it be known that my point of view is that of someone with plenty of application development experience but without a formal IT or CS degree. I can't go on about the merits of one design pattern vs. another. I do, however, understand the need for convention, the advantages of modularity, and the efficiency of easily repeatable processes.

Please note that symfony, Prado, Code Ignitor, and many of the other PHP frameworks all look quite capable of meeting most project needs. If you're a fanboy of another framework, please don't espouse it's merits here. I am, however, interested in hearing about your general experience in learning a framework, particularly in the context of your professional background.

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
CakePHP Zend Framework Notes
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.
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.
CakePHP's documentation is good but Zend's API documentation is more thorough.
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
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.
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.
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
I may be wrong, but I get the impression that PDO is gaining favor in the PHP community.
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.
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.
Both provide file-based caching of pages. Zend supports several cache backends, including APC, SqlLite, and of course, the Zend Platform.
Both provide robust session handling.
Both provide application logging. IMHO, the Zend_Debug class gives ZF the edge in this category.
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.

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.

CakePHP comes with built-in support for Prototype and 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

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.

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
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.

CakePHP: Hit the Ground Running Fast

If you are new to MVC, require PHP 4 support, want stricter conventions, or want powerful code generation tools, CakePHP is the choice for you. CakePHP's Scaffolding, Bake, and ACL scripts provide definite advantages when the need to quickly build an application arise.

The Zend Framework: A Model of Flexibility

If you know MVC, need more control over application design, or want built-in support for popular Web services, the Zend Framework is choice for you. The Zend Framework provides a greater degree of flexibility in designing applications that scale effectively in high-performance environments.

The bottom line is that both frameworks are rapidly evolving in response to user demands. Gaps in each are being filled and there seems to be no lack of demand for developers with skills in each framework.

Feel free to share your experience in learning any framework.


Zend framework is unusable with mysql

I just tried Zend framework for the last three days - it is unusable with mysql, because they don't know how to properly handle mysql query cache. If you try to port their QUICKSTART example to MySQL, you get nowhere with the error:

Message: SQLSTATE[HY000]: General error: 2014 Cannot execute queries while other unbuffered queries are active. Consider using PDOStatement::fetchAll(). Alternatively, if your code is only ever going to run against mysql, you may enable query buffering by setting the PDO::MYSQL_ATTR_USE_BUFFERED_QUERY attribute

- only their proposed solution does not work. They claim it "only" affects MySQL pre-5.1.17, but im running 5.1.31 with same error.

Not properly supporting the worlds most used database vendor is inexcusable, and it has been this way (according to their error logs) for over a year. Epic Fail, Zend.
And yes, the error is caused by PDO, but using a faulty component in your framework is NOT an excuse.

To sum up: Their faulty framework just stole three days of my time. When they cant even have everything working in their quickstart example, no way am I going to chance it that they know how to do anything else

Conclusion: Stay away from Zend Framework!


nice comparison. it helped me a lot :)

CakePHP Zend Framework Fusion

Hi You can use Cakephp with zend framework.
Please go to to make it working


Great comparison dude, it's the simples and still most complete comparison I've seen, it helped me a lot to understand each framework and their differences, and I'm close on choosing my PHP framework now!

Congratulation on the quality of the post and tnx for the help!

Good...but outtdated

I would not use this as a fully reliable source for comparing ZF. If you take a look, a lot of the comparisons shown here would change drastically given all of the new features it has in the framework.


very nice article

My experiences...

Hi all,

The article is a bit outdated, but the comment thread seems to be kicking so why not add to it?

I remember when my team and I arrived at the same two choices. We spent a good deal of time comparing the two, building dummy apps and production apps ( new clients make great guinea pigs ), held plenty of meetings and eventually decided upon the Zend Framework.

The article has a nice outline between the two, so I'd like to simply share my experience with this and perhaps pick up where the article left off.

The discussions eventually boiled down to where are we and where did we want to be? At that time we had built up a decent library in which to develop web sites and tools for our clients. We had a cluster of servers all running php4, so from a cost perspective it was cheaper to lean on Cake.
The problem with cake was two fold, first off the documentation at the time was really sparse and more often then not, outdated.

This presented us with having to spend additional time to learn and train the team, which would bring up the cost up. Additionally new staff and contractors would need more ramp up time when they came on.

Zend on the other hand was just coming out, and even though the documentation suffered at times like cake, we found it to be more consistent in its approach ( like the code ) and more to the point. There are assumptions that are made, knowing php5 and oo are mandatory. We liked the fact that we could find zend developers easily and bring them in to assist on projects that need additional resources. Heck, Zend even offers a cert for developers to test for.

We had little experience in the team directly with php5, but learning the next iteration of the core language we worked on sounded more fun, not to mention better for our own skill sets, than learning to work within Cake and its conventions.

A downside, at the time, was that Zend provided no modularity. By that I mean, we couldn't run instances of zend as a collection of applications, at least not with out giving up some performance. We decided this was acceptable and used it as an opportunity to develop our own framework.

Also we decided that we needed more power between our app and the db, so after a bit of research, we landed on phpDoctrine. Doctrine is an ORM ( Object Relational Mapping ) library. Again, at the time zend had little feature set with their zend table and db... since then it has improved.

Side note on doctrine:
The doctrine code base is a robust abstraction and object mapping layer for php applications. For basic interactions with a db, mysql, it is overkill. Using this library will provide you with a wide range of functionality, much greater in breath then what zend provides. This comes with a price though, the objects are resource intensive and if not used properly can bring your application to a crawl. The documentation on this is not very well done, but the examples are well shown. There's not much of a community so you should be prepared to find your way in the dark at times. ex: Cascading deletes didn't work on MyISAM tables, so we had to patch that until they did it themselves. Ok enough about doctrine...

Right now our framework is being used primarily as a cms for public facing sites, and as a framework it is still in its infancy ( client work took first priority ).

The Zend Framework turned out to be the best option for us. As zend grows we are getting some very solid components to work with. If you haven't yet, check out the latest version release a short while ago, 1.8 as of writing. Zend has some nice interfaces for hooking into Amazon's "cloud" and fantastic code generation ( No more template approaches for automating new code, such as models or modules. There are a few others, so check it out and see for yourself.

So what is the better solution Zend Framework or Cake? Well that depends on you, your own needs and goals. Do you need to bang out a quick project that while having robust code at your fingertips while giving you the power to create customized functionality, Cake may be your best bet. Do you need a code base to build from on an ongoing basis, Zend may be the choice for you.

Find out, and post your experience... maybe this article will last a few years.

Cheers and good luck!

San Diego, CA
Senior Developer

A blog post in a comment

@dev_head, thanks for sharing your experience in such depth here. Writing a custom framework certainly allows you to optimize for your environment and other requirements, but I shudder to think about the extra work it takes to maintain.

Since writing this article, I have yet to write a complete app with either CakePHP or Zend, but I've kept up on Zend releases and have been really impressed. Yes, Zend_Tool is providing something akin to CakePHP's scaffolding features.

In my experience I chose

In my experience I chose CakePHP over other frameworks
because its fast to learn and because of its strict conventions it made my code very readable. The documentation are ok and most of all there is an IRC Channel #cakephp on
which is very active.
And also if ever there is a need to use libraries coming
Zend Framework you could also use them in CakePHP.

Update needed

You need to update this comparison especially because Zend Framework DOES support JQuery and Dojo JS Frameworks

Thanks - Going with Cake

You've confirmed my thoughts on frameworks for php. I'm going with Cakephp because it just feels right. Zend has always given me the creeps for some reason. Thanks for the article!


Thanks for this article.

Thanks for this article. This help me those the right framework for my work.

Keep up the good work.

I agree, that many framework

I agree, that many framework developers are not aware of performance issues. A reason for that may be the availibility of byte code caching or other tools to store information (e.g. application caching, memcached, …). But this is not true for everyone. Especially, the APF is designed for best performance (see Combined with a rich featureset (see, the APF is worth a try!


Thanks for this article.

Good comparison and straight forward arguments.

Best regards

Best comparison I read so far!

Thanks for this article. This is the best comparison between ZF and Cake I read so far.

Keep up the good work.

Great Comparison, Thank you.

I finally broke down and decided to pick up one of the popular frameworks out there. I had just started writing up a similar comparison when I found your article. Thanks for saving me the time!

I've chosen to go with Zend primarily because of its industry backing. I mean, PHP is made by the Zend guys... seems solid to me!

Anyway, cheers!

I've used Andromeda DB

I've used Andromeda DB Framework and its awesome!

Great Article!

Thanks for the review! Appreciate the time spent in listing down the differences for a php newbie like me.

ZF is licensed with "new" BSD

Just in case someone wonders, I had a quick look at the documentation and it says at that they use the "New BSD License" where the third "advertising clause" from the original BSD license is missing.

That makes it fully compatible with the GPL as written here:

Thanks for the good comparison though, I was wondering which framework to use when building an addon for the BIGACE Web CMS and ZF won, because its easier to integrate into an existing app.

a great thanx

Hello! you know, I'm a beginner at this job, so i just started learning about php and how it works, but your article on PHP Framework was really helpfull for me... that's why i'd like to say a great thanx to you!


For those who value flexibility and freedom over forced convention in frameworks, I recommend having a look at Kolibri. While it provides sane defaults with no/minimal configuration, you are for instance free to use the template system you prefer, whether it is XSLT, Smarty, pure PHP or something else entirely.

Another criterion: easiness to learn

Thanks for your great comparison!
I made a short review of the main available frameworks, and my final selection ended with ZF and CakePHP. Your comparison helps me to learn more to choose one from the other...

But there is still a missing criterion in your comparison which I would find very useful: how easy was it to learn each of these frameworks ? According to your experience, which one requires the least time to get confortable with ?

Thanks in advance.

No comparison.

You can use Zend inside a Cake app. You can't the the opposite.

Codeigniter seems friendly and concise to beginners

I am not a php geek. when I started looking in search for a framework to start with, I was really impressed with Codeigniter at the first shot. It's simple and has a great documentation. To begin with a PHP framework, its really a great decision to go with Codeigniter and when your need demands more, you can go for another framework or can still checkout Codeigniter libraries and forum.

About PHP Framework

Thanks alot, this is a great article and resource for me. A really good discussions about different php frameworks for web. This is what i was looking for. i bought 3 books on frameworks for PHP, and learning different aspects of PHP4 and into PHP5.

Excellent comparison

About two years ago, I started looking at CakePHP, and the documentation was absolutely horrible - sections of info were missing, the docs were out of sync with the code, and I had difficultly obtaining help from a human with seemingly basic CakePHP issues.

I basically gave up on CakePHP in favor of CodeIgniter, and never really looked back.

Out of curiosity, I started digging around for CakePHP info again, and I can say their docs are now light years ahead of where they used to be. The only thing that bothers me is their examples/tutorials still seem to be the ones from two years ago, and some of the info is incorrect or deprecated.

My problem with Zend framework is that sometimes plain ol' raw PHP is better than a class extending a class extending a class as a wrapper of a PHP function... Though I suppose all frameworks do that from time to time, for the sake of modularity.

Anyway, excellent comparison. I hope you'll write a follow up at some point once you've developed a project with one of the frameworks.

fabulous article, did you know?

Just wondering if you are aware that the Joomla 1.5 CMS has MVC include as part of the framework

Most suitable

I think the major doubt inside the decision of choosing frameworks is which one fits better on some specific project.

I have doubts on that, and no comparison I have found show me clues that would point the solution...

For example, which one would be more suitable for multiple projects with common data, sharing common database?

Is it possible to say what cases CakePHP will work better than Zend Framework? As well the opposite?

No comparison is going to answer this question

No comparison is going to answer this question for you completely. Hopefully these types of comparisons can shed light on a few points that pertain to your project.

There are too many variables, considerations, and preferences. I encourage you to download and try those frameworks your considering.

Cake has the edge on testing

One big selling point for CakePHP is that its test framework is Simpletest, while ZF uses PHPUnit. The difference between these two is that simpletest has better mock object support.
This is important if you test first, then write code--which you really should try! it's liberating--because your controller frequently interacts with model (database) and view, so it's nice to know, by using a mock database/view, that your controller is doing exactly what it should. In other words, you have to have the mocks in order to fully test (i.e., define by means of tests) the controller's API.

Basic search

tells eveything. Google results of cake are around 3.700.000 pages. Zend are around 637.000 :)

Also Cake is now version 1.2. Imagine the pain and suffer during all this version staging period.
I would like to go with mature framework.


"Google results of cake are

"Google results of cake are around 3.700.000 pages. Zend are around 637.000"

17th of August, 2009.

Results 1 - 10 of about 4,510,000 for cakephp


Results 1 - 10 of about 6,370,000 for zend framework

Seems to be its obvious, what is more supported nowadays..

Volumes of searches really

Volumes of searches really tells you absolutely nothing. I found it best to try out the basic tutorials on the frameworks and see what you like the look of for your project.

Also - I can't say I have found Zend's documentation 'excellent' as it reports above - which is another reason I have chosen Cake to try for the next project.

Searches narrow down the list to test

I disagree. I think searches shorten the list of things to download and try.

Something to be said for quality

Quantity and age are certainly not representations of quality or appropriateness. I encourage all who are evaluating PHP frameworks to dig a bit deeper. I've been spending quite a bit of time with the Zend Framework since writing this comparison and have been please with the results achieved so far.

ZF has announced a partnership with the Dojo JavaScript Toolkit and the upcoming ZF command line tools. Each of these announcements demonstrate that the ZF is quickly bringing it's feature set up to that of other PHP frameworks.

Another point that I didn't include is training. The ZF is backed by training provided by Zend.

All I'm trying to say is that folks should dig a bit deeper when deciding what might work best for them.

Freedom of choose

One of the js tools like prototype or jquery dojo or motools. This is totally related to my problem domain. That's why we have bunch of frameworks and we decide one or another. I am not exciting to hear Zend Dojo cooperation. We saw a kind of conquer and dominate market sh*t before.
Just be a coder, check code to understand that;

SomeOne.prototype.change = your_life

I can choose!

One of the js tools like prototype or jquery dojo or motools. This is totally related to my problem domain. That's why we have bunch of frameworks and we decide one or another. I am not exciting to hear Zend Dojo cooperation. We saw a kind of conquer and dominate market sh*t before.
Just be a coder, check code to understand that;

SomeOne.prototype.change = your_life

I can choose!

One of the js tools like prototype or jquery dojo or motools. This is totally related to my problem domain. That's why we have bunch of frameworks and we decide one or another. I am not exciting to hear Zend Dojo cooperation. We saw a kind of conquer and dominate market sh*t before.
Just be a coder, check code to understand that;

SomeOne.prototype.change = your_life

Several things about Cake

Just my 2c:

Compatibility: Cake will switch to PHP5+ only in 2.0 (according to

Configuration: Cake has a default configuration in a PHP file, but there is nothing stopping you to override it and read the configuration from an XML file or database or whatever you want.

Caching: I believe Cake supports more than just "file cache":

Very nice comparison though!

Nice article!

A great comparison between the two frameworks Chad! :-)

Inspired by your comparison, I wrote a similar article/comparison on CodeIgniter and Kohana.


Hopefully some people will find it useful.


Great comp!

Yeah i have to say it's a great comparison. I always used Cake Php, but i start thinking about trying igniter, as the documentation seems to be way more available. Having good info about our php framework is almost 50% of how we're going to like it, it's some time a pain to try to find out everything by yourself. Anyway, i still have to say it's two great framework ;)

Try Django !

I originally come from the PHP world but have been using Django (a python web framework) since a few months. I am really impressed by the quality, the features and the extensibility of this framework !

Concerning PHP, I am a big fan of CakePHP.

A useful start to have an overall view of PHP and non PHP (Ruby, Java, Python) frameworks :

Good Review

Excellent review and very fair. I think you found the main differences in the MVC and configuration/convention differences. Also the ZF is extremely loosely coupled so that it's trivial to integrate most components (such as Zend_Search or Zend_Pdf) into another application.

One minor point is that the ZF also supports PHP arrays for configuration, though my personal preference is INI.



I would say configuration

I would say configuration through arrays is a rather good idea. During implementation of my application I've discovered standard PHP .ini parse function doesn't preserve variable values in a strict fashion:

ini_variable = true

results in value of $config->section->ini_variable to be === 1. This is certainly not what I want: for me 'true' means PHP true, 'false' PHP false, and '1' PHP 1 (or '1'). It really starts to matter when your code uses strict (===) comparisons (which, personally, I consider good PHP programming practice). So, I have written my own INI parsing method, and now I make a call:

$config = new Zend_Config(Argasek_Config_Ini::read($thisdir.'/cfg/whatever.ini'));

and convert array returned by ::read into object. Nice and clean.

Thanks Rob

Yeah, I just noticed PHP array support in the Zend_Config docs a few days back.

Another Framework

Can I suggest another framework?? Check out the Andromeda Database Framework.

Symfony Project is the best

i was in the same boat a while ago and my choice in the end was
* simple templating and helpers
* cache management
* smart URLs
* scaffolding
* multilingualism and I18N support
* object model and MVC separation
* Ajax support
* enterprise ready

i have used code igniter for many projects in the past but it really has limitations. Symfony is a entire development platform, debugging, etc. I could never go back to anything but Symfony now

Great Comparison

I'm forwarding this to Matthew so that we can go over some of your detailed view/controller/helper feedback. I hope you've gotten a chance to go over the new features in 1.5- many of these comparison points are addressed directly in this release. I can tell that you'll also be very interested in our next minor release. We'll be making a concerted effort to forge in to new, exciting, and entirely uncharted(!) territories with our AJAX/RIA support.

Thanks for taking the time...

Thanks for taking the time to review my review :)

In regards to view templating, I should probably qualify what really is a relatively minor difference for those reading this. With CakePHP, view wrapping works out-of-the-box, just save a default layout and your views are wrapped by the layout immediately. Layout wrapping in Zend actually isn't that difficult, only a few lines of code are required.

I think ZF users would benefit from an HTML helper, especially in light of increasing use of Ajax in web applications. I picture a lot of JS errors being avoided during development by having a helper generate HTML elements (unique ids, valid tags, proper nesting, etc). Heck, you could throw client-side validation (HTML, CSS, JS) into unit testing :)

I hope to have some time soon to take a closer look at 1.5. Thanks to you and Matthew for all of the great work on the Zend Framework.

My Clairvoyance

Ha! I just looked and the logo _is_ a flame. I guess it almost had to be, right?

copyright © 2011, 2 tablespoons | Privacy Policy