Tuesday, March 4, 2008

Code Igniter v. CakePHP

Since I work with so many web sites and meet so many PHP developers, I see a lot of PHP frameworks. The two frameworks for building web applications in PHP that I come across most often are Code Igniter and CakePHP. Loosely, both of these frameworks incorporate many of the principals and patterns (including MVC and ActiveRecord) that made Ruby on Rails so successful. Recently I asked myself: which would I use, CakePHP or Code Igniter? First I found a comparison of the two frameworks, but it wasn't too helpful, especially as these open source projects evolve so fast, and that comparison is almost a year old.

I watched the video tutorials for both of them, and downloaded the code for both, eventually building a prototype application in each. But I still wasn't satisfied that I had enough information to make a choice. Which is better? Code Igniter or CakePHP?

Maybe the wisdom of crowds has already figured this out for me, I thought. So I checked Google.

> 781,000 Search Results for Code Igniter (only 50,200 for "Code Igniter")
> 2,510,000 Search Results for CakePHP

Well, CakePHP certainly wins on that dimension. Maybe this is because Cake has been around for longer? Codeigniter.com was registered on 15-jan-2006, Cakephp.org has been around since 13-Jun-2005. 18 months is a long time in the world of open source frameworks. So I checked out the traffic stats on compete.com:



CakePHP wins again (although by a lot less on this one).

Since CakePHP was the more established, and by my measurements the more widely adopted framework, I was leaning towards Cake. But then I thought of the case of Information Cascades. What if, just because people were using it already, other people used that logic to make their adoption decisions? The NYT just ran a piece about how Information Cascades contributed to smart people making bad decisions during the recent housing bubble:

Three economists, Sushil Bikhchandani, David Hirshleifer and Ivo Welch, in a classic 1992 article, defined what they call “information cascades” that can lead people into serious error. They found that these cascades can affect even perfectly rational people and cause bubblelike phenomena. Why? Ultimately, people sometimes need to rely on the judgment of others, and therein lies the problem.


Hmn. So CakePHP has first mover advantage, which could lead to an 'information cascade' affect regarding subsequent adoption. How to decide? For me it came down to one thing: Code Igniter has better documentation, which makes me more productive, faster. Winner: Code Igniter. :)

6 comments:

Mojo said...

Hi Joe, Good comparison and good writeup.

I got so fed up with cake and gave up on it last year and then I found CI. I have to agree with you. CodeIgniter has killer documentation. I've been playing around with it for a few weeks and one thing I noticed is that it is quite fast comparing to Cake. Also CodeIgniter has an active community as you can see from their forum.

Let's just hope EllisLab doesn't screw with their OpenSource model.

Joe Rosenblum said...

That's good info about the speed comparison. I've also found code igniter blazingly fast, but I haven't done anything that's of really large scale in Code Igniter.

Derek said...

Cake has great documentation and articles with sample code in the bakery. And now with 1.2 out CI is not even close to matching up with Cake. To me there is no comparison. Cake is just a better framework.

Afnan said...

May be cakephp is unable to present its documentation in more user friendly way.

presentation failure!!!

Afnan said...

One more thing ... CI doesnot have H-MVC thing. CakePHP supports it very efficiently.

CottonIJoe said...

Hmmmm.... Maybe you should just write CodeIgniter in one word like it is spelled correctly. Then you would get 3500000 hits for CodeIgniter and you could obviously rewrite most of the stuff you wrote... :p