The Zend Framework, developed by Zend Technologies is an open-source, object oriented web-application framework implemented in PHP 5. It is widely known as ZF and is developed with the purpose of making things easier for PHP developers and supporting best practices at the same time. CakePHP too, is an open-source web application framework used for creating web applications written in PHP. It is developed by Cake Software Foundation, Inc. It is written in PHP and is based on the model of Ruby on Rails.
Zend Framework has easy methods of licensing with the new BSD license and a swift and well-tested code base that your business can rely upon. It makes use of commonly available APIs from well known vendors like Google, Amazon, Yahoo!, Flickr and API providers and catalogers such as StrikeIron and Programmable Web.
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. Moreover, Zend Framework also offers:
- AJAX support through JSON, which offers ease-of-use of the framework.
- The PHP version of the Lucene Search engine.
- Simple access to data formats needed in Web 2.0 applications.
- The ideal destination to utilize and publish web services.
- Top quality, object-oriented PHP 5 class library.
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. CakePHP boasts of clients like Mozilla Addons, Scratch by MIT, Yale Daily News, Onion Store and MapMe to name a few.
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.
|
PHP Black Book, Peter Moulding, Good Book US $1.00 Auction Ends: Friday Feb-12-2010 17:14:58 PST | Watch this Item |
|
Learning PHP 5, David Sklar, Very Good Book US $7.61 Auction Ends: Saturday Feb-13-2010 4:51:30 PST | Watch this Item |
|
PHP Unleashed, John Coggeshall, New Book US $9.00 Auction Ends: Saturday Feb-13-2010 11:13:39 PST | Watch this Item |

47 Comments until now
Or you can mix and match the two frameworks as I do
I would assume mixing these two frameworks would get a little sloppy though. Do you have any tips on how you do this?
Here’s an example of the two being mixed (CakePHP + Zend Lucene)
http://bakery.cakephp.org/articles/view/integrating-zend-framework-lucene-with-your-cake-application
Following the pattern set down in that tutorial, it should be strait forward to implement many of the web service components of the Zend Framework, though, it would be much harder to mix things like Zend_Controller or Zend_DB into CakePHP.
Ive never mixed Cake with ZF, but I did write an app a while back mixing ZF and Propel, which is the backbone for Symphony. I find that integrating external libraries into ZF is pretty simple. Although I agree with Douglas that mixing two MVC architectures seems like a potential cluster, unless of course you are only using ZF as a toolkit and not an MVC.
In developing my latest project I decided it was time to finally knuckle down and really learn to use an MVC framework. While I’m not a fan of having a monolithic library I’m completely new to the MVC concept so I decided to choose one.
In the end my choice came down to these two and I eventually decided to go with Zend for the following reasons:
* Zend is written in PHP5, Cake in PHP4. Recently I’ve started to reject code written in PHP4. PHP5 has been out for a long time, and the whole issue of “hosts not supporting PHP5″ just isn’t an issue anymore. A framework expecially should take full advantage of PHP5’s advanced object-oriented capabilities.
* Zend provides full OpenID support. This was specifically important for my project – I needed something that had been fully tested. While I could have used JanRain’s tools I didn’t want to use their system that ended up as 4 times the filesize of my prototype application!
My issue with using gigantic libraries is not as present anymore thanks to __autoload – with ZF takes advantage of.
Just why I decided to choose ZF over Cake
@Douglas Brown
Because of Zend’s “best practices” approach to development, most of the libraries are independent classes not reliant on the rest of the framework. This means you can grab a library (Zend_Flickr, for instance) and drop it into virtually any other framework and use it as a library within your favorite framework.
This is a pretty common practice in the CodeIgniter community as well. It’s a great way to get added functionality that has been tried and tested, without having to write the class yourself.
@Ross:
CakePHP runs both on PHP4 and PHP5. I believe that some internal libraries are checked runtime: the php5 version is choosen over the php4 version when that can be done. But the most part of the existing “plugin” you can find are PHP5 only.
I’ve managed to become very familiar with both ZF and Cake, but I have to say that CodeIgniter has my vote, its faster and least restrictive.
Even Rasmus Lerdorf prefers it (http://szeged2008.drupalcon.org/program/sessions/rasmus-lerdorf-keynote-simple-hard).
I did the same analysis of frameworks in the early summer time frame as @Ross. I came to the ZF conclusion as well for many of the same reasons. I was impressed by the breath of the 1.5 and later components. I valued the ability to use the components without the whole framework.
As far as this post goes I think it’s worth sharing that I wouldn’t recommend ZF as the first framework for people, at least not yet. While the situation is improving I don’t think there is enough guidance for putting together your first non-trivial application from the start. There are many tutorials which are too trivial. You’ve got to write quite a bit of code to get your first CRUD screens up. It’s quite a difference from the style where you can start with a DB schema, push a button and get a skeleton code generated. I think Zend Tool will address this but it’s not ready yet.
@Ross, how far along are you with your ZF project?
Now that I’ve climbed a bit of the learning curve I think I’ll stick with ZF for it’s flexibility, but as I said, I would caution anyone who will use ZF as their framework.
CakePHP has poor documentation. Zend Framework with work with other frameworks as well. CodeIgniter has excellent documentation and is one of the fastest frameworks out there.
Whats the best for someone who wants to learn php??
The Zend Framework definitely has better documentation. So I Would say if you were just getting started using an MVC Framework, ZF would be a good place to start. What do you guys think?
It seems that ZF is everywhere! With Zend behind ZF, it is being pushed around a lot and it seems like it might become THE framework to use for PHP. I’m sure those who prefer other frameworks would put forward their arguments as to why those frameworks are better than ZF but it seems that if you are going to learn a framework now, it should be ZF.
Applicaiton built on ZF is slowly than CakePHP. Is there any tip for this problem? I have used Zend_Cache to cache my data but still slowly than CakePHP.
@Jermayn, if you’re just learning PHP, stay away from frameworks. Frameworks won’t teach you anything about the language itself, but it may teach you a thing or two about design patterns and best practices.
I myself used ZF as my first MVC framework because I wanted to learn how they work in general. I don’t like the 10-minute blog Rails-style where they generate the code for you and does lots of magic behind the curtains. But that’s just me, I recognize that some people prefer typing away and get instant results without having to know anything aside from the logic they coded. However, now that I’ve learned about MVC concepts and OOP patterns from ZF, I’m confident that I can just jump into the code of any application written in some MVC framework and get a general clue on what’s happening.
@Douglas Brown & @Michael Wales:
I’m leaning towards Zend in this battle. But what about Zend vs. CodeIgniter. Any ideas?
@George From Ohio – I have always been a fan of ZF, mainly because it is obviously backed by Zend. I have noticed that at some points it runs a little more sluggish than it should. I could have been implementing it incorrectly though.
As far as CodeIgniter goes, I think it has a smaller footprint than ZF. Other than that, I think they are on the same playing level. If I were you, I would try them both, and see what style tailors to yours.
CakePHP can easily load Zend’s component classes.
http://bakery.cakephp.org/articles/view/zend-framework-loader-component
Outside of using the ZF Database or Controller classes ( which would be redundant from within Cake ) there is nothing ZF offers that can’t be used alongside or from within a Cake App.
As for the documentation complaints..
http://api.cakephp.org
http://book.cakephp.org
http://bakery.cakephp.org
http://planetcakephp.org
should have you covered.
What about from a career perspective? Would ZF be the best MVC framework to have on your CV? Again, it seems to me that due to having Zend behind ZF, it would be the natural choice for new projects, specially if they are of an ‘enterprise’ nature. What do you guys think?
@Ziad – I have to agree with you there. For the sole purpos of helping your portfolio, I wouldn’t even think about any other framework than Zend’s.
“Just like ZF, CakePHP does not require configuration.”
Wha….?
On the contrary, ZF requires TONS of configuration — more configuration than any of the top PHP MVC frameworks. ZF makes no assumptions and has very little automation. You’ll be spending spending the first hour or two just setting up your directory structure, config files, and writing your own bootstrap.
ZF is more of a component library (like PEAR) than a rapid application framework. Personally, I use CakePHP and pick and choose components from ZF as I need them.
I really wish people would start giving up Cake in favor of Fuse ( http://www.phpfuse.net ). Cake is such a mess comparatively, and their default templating setup is really just ugly inline PHP.
One of the primary goals of the Zend Framework is flexibility. I think they achieved that very well given the ability to use it as a full stack or component framework.
However the cost is there is very little prescriptive guidance. During the summer when I was scanning the mailing lists, there were a lot of responses of the sort “there is more than one way to do things in ZF”, or “there is no *one* right way to do…”. While those responses are probably accurate and get their point across, it still left a gap in guidance.
There are some efforts to correct this, Matthew Weier-O’Phinney is working on two complete apps to show best practices,
http://weierophinney.net/matthew/
Unfortunately I have no idea what the best first framework for someone would be. ZF has a steep learning curve without that much assistance, yet.
If you do go the ZF route first, you should also do some reading on patterns as there are a number that are used and helpful to know.
–Rob
You choose the best and quickest framework for the job. If you’re building a CMS that has a quick turnaround CakePHP is more suitable. If you have a slower turnaround with requirements such as slow query profiling, heavy usage of web services then go with ZF, I use both frameworks, the client gets what they pay for at the end of the day, that’s what it comes down to.
Can someone compare ZF vs CakePHP based on the ease of integrating external ajax libraries like jQuery and YUI specifically.
That’s actually a pretty good question. I would love to hear some thoughts on that. I normally don’t use JavaScript libraries, so I can’t really offer an educated opinion. I know the ZF has recently added native Dojo integration and support, but I haven’t used it yet.
Both are just as easy as eachother, where CakePHP offers an easy way to route ajax requests using an xml/rss prefix as does ZF, both also allow you to detect whether a request is being made using JSON or Ajax. ZF just takes a little more setting up than CakePHP
yea I know ZF has Dojo integration but a framework (in my opinion) wins on this front only if its extensible enough to allow *easy (read “properly documented”) integration with any ajax library of developer’s choice (jQuery or YUI in my case)
Hi Gavin,
I would appreciate if you can provide some links that document this integration for both these frameworks.
I’ve used CakePHP with a variety of libraries with no problem, as with ZF, for my backend/admin area I use Dojo with ZF because it’s quick and easy, but on the frontend/user area I use jQuery because it’s lighter than Dojo and I quite often don’t make use of all of Dojo’s library features.
this link seems to present a pretty good doc for jQuery + ZF integration.
http://jquery.hohli.com/zf.html
will definitely give it a try next time I try integrating them.
There’s a request parameter in CakePHP 1.2:
http://book.cakephp.org/view/419/isAjax
And there’s a constant you can change in CakePHP 1.1:
http://book.cakephp.org/view/310/Configuration (it’s under /app/config/core.php)
ZF Ajax detection:
http://framework.zend.com/manual/en/zend.controller.request.html#zend.controller.request.http.ajax
What is you opnion about CodeIgniter?
Thanks!
Hmm… About CodeIgniter? I don’t really have any experience with it. Hopefully, someone else can give a decent review of their experience with CodeIgniter…
OK, Thank you anyway!
I am not a fan of Cake. The component and model code you end up writing becomes useless should you need to port to another framework. Might as well just write everything as stand alone classes and put them in the vendor folder. Also, for any high availability site it creates too much overhead. Try a dump of $this from a controller – probably crash your browser. It’s model caching will burn you. Actually, to be honest I hate Cake.
My vote is for Zend Framework. ZF can be used as a MVC or more as an external Library, a la PEAR.
Can anyone summarize this comparision on tabular format or can provide a link where it is
Here you go Hetal,
FrameWork | Good | Bad |
————————
Cake | | X |
ZF | X | |
————————
I really hate cake. If you are new to programming or php maybe it is better for you, but as a seasoned professional, I hate the automagic way it does things. It is very cool when you build the tutorial, but when it comes to a real application, you will end up pulling your hair out trying to figure out how it does realitvly simple things. I like Zend, if you know what you are doing it lets you do it faster, not hold your hand and never let it go.
I like Gavin William’s comments. I have used both cakePHP and ZF. Cake does a lot of automagic stuff which is sometimes hard to track down in the code, but it is very quick to get something running, like a CMS. The documentation on Cake is great, better than Zend I thought. In any case there is a lot of documentation in the code base and a pretty good IRC channel, not to mention quite a few blog posts out there from the cake community on how to achieve certain tasks.
What I don’t like about Cake is too much of the automagic stuff, as someone mentioned the classes can be very heavy and the cache will burn you a couple of times at least
Also not that keen on all the sql queries to build model classes from the db. But thats just personal preference and mostly those are minor issues. It is awesome to get up and running very quickly with an app and the codebase is considerably lighter than Zend.
I absolutely love ZF. I did made it as a coding standard in our company. I built our own framework on top of ZF, and it’s fantastic. The only reason that make “ZF” bloat as what other people say, they just don’t know how to do it. It may be hard at first, but when you examined closely, ZF could just be the best.
Who else knows better how to build a faster framework for PHP other than the ones creating PHP?
Tweetbacks
PHP Update: Zend Framework vs CakePHP Framework: The Zend Framework, developed by Zend Technologies i.. http://tinyurl.com/6jemsu
Sweet! My PHP article made phpdeveloper.org top post of the week! http://tinyurl.com/6jemsu
@bradyjfrey Another comparison of Zend & Cake: http://tinyurl.com/6jemsu
Currently Browsing: http://tinyurl.com/6jemsu
Trackbacks
Add your Comment!