CakePHP vs CodeIgniter

People should no longer do webdevelopment by coding all PHP by themselves. If you want to become a better webdeveloper in all ways, you should be using a framework.

I’ve developed several applications using both. Here is the conclusion I’ve come to:

  • CodeIgniter is, without a doubt, the most well-documented and approachable PHP MVC framework out there. CakePHP’s documentation is also very good, but the learning curve is slightly higher.
  • CodeIgniter’s models are optional and serve no function other than code separation. There’s no integrated CRUD and its “Active Record” class is really just an alternative SQL syntax. It also doesn’t support table associations. So, you will be building many large queries essentially from scratch. CakePHP’s models are far more advanced and similar to those in Ruby on Rails. It supports table associations, has integrated CRUD, and behaviors. In addition, CakePHP has command line tools (Bake) that allow you to generate all the code for basic CRUD operations. Tweak a few things here and there and you’ve got a working prototype in minutes.
  • CodeIgniter lacks some essential libraries that are needed in most applications (i.e. Authentication and ACL). You will need to rely on 3rd party libraries in many of your applications. CakePHP has integrated Auth and ACL, but both frameworks integrate with 3rd party libraries easily.
  • Since CodeIgniter lacks much of the automation that CakePHP brings, there are no strict conventions to follow (this can be viewed as good or bad). This makes CodeIgniter a more flexible framework. Furthermore, its lack of features and automation do give it an advantage when it comes to speed. CodeIgniter is one of the fastest PHP MVC frameworks out there. That said, the framework is rarely the bottleneck in your in application…and you should be choosing a framework based on productivity, not its execution speed.
  • Both frameworks have large and helpful communities. CodeIgniter has their official forums and an IRC channel. CakePHP has a google group and an active IRC channel. CakePHP is currently the most popular PHP MVC framework with the largest community behind it.

CakePHP

+ Solid support (irc.freenode.org @ #cakephp can be very helpful)
+ Great documentation
+ Good performance.
+ Shades of RoR if you are into that
+ Good amount of plugins available
- Generated queries can become unsightly
- Overall pretty large overhead

CodeIgniter

+ VERY small footprint
+ Greater control of application flow
+ Great documentation
+ Great performance
+ Very little configuration
- Not quite as many plugins available
+/- Less automagic in some places

Overall, I have met people that live and die by both of them. They both have their place in my heart so I’m not really going to “pick a side” – just take a look at both of them and decide which one is for you. Please also note that the minuses I put under both are things that are very easy to overcome, just kind of giving an overview of my personal experiences.

In conclusion, if you want a fast, flexible, well-documented framework, and don’t mind writing extra code and relying on 3rd party libraries, go with CodeIgniter. If you want a powerful, feature-rich framework that does most of the heavy lifting through automation, and you don’t mind having to follow strict conventions, go with CakePHP.

Leave a Reply