CakePHP vs CodeIgniter

It’s an old debate, running for ages and still debate on air! But While i worked on different projects with these frameworks, i felt few lacking of both frameworks, at the same time impressed with xcellent features. I’ve made a list here –

Auth, ACL Component/Library
CakePHP has very strong Auth component with Core.
In CodeIgniter – you have to create or find a suitable plugin for you, although CodeIgniter has many classes which are rarely used(such as ftp class) i wonder why it’s not there. It’s vary important for the most of the applications.

Code Generation
CakePHP’s Bake console can create any of CakePHP’s basic ingredients: models, views and controllers, can create a fully functional application in just a few minutes.

Very badly, Codeigniter doesn’t has code generation from console, you’ve to find out a plugin.

ORM
CakePHP comes with ORM(Object Relational Mapping is a programming technique for converting data between incompatible type systems in databases and object-oriented programming languages) while in CodeIgniter, you have to depend on third parties.

Scaffolding
CodeIgniter’s Scaffolding feature provides a fast and very convenient way to add, edit, or delete information in your database during development which is deprecated from version 1.6.0.
CakePHP scaffolding is a technique that allows a developer to define and create a basic application that can create, retrieve, update and delete objects. Scaffolding in CakePHP also allows developers to define how objects are related to each other, and to create and break those links.

Ajax
CakePHP comes with Ajax helper which can be used in various ways. i didn’t see this with CodeIgniter core.

PHP Version
Both runs on PHP4 and PHP5 but both doesn’t take any facility of PHP5 while runs on PHP5 Machine. CakePHP declared, their upcoming version 2.0 will runs only on PHP 5.2 which definitely take advantage of PHP5’s OOP and ohter killer features.

Simplicity
I believe CodeIgniter is simple and working with this, it’s so easy while in CakePHP coding process is quicker for expert but its hard to find out what’s going on For Newbie.

MVC
Both of them are MVC supported framework but in Codeigniter you can build your project without Model which may lead messy and unsecured code sometimes(if anybody place direct query without any filtering). Codeigniter Model supports Method Chaining(PHP5 only) feature that’s fantastic. Most important is Model association, which absent in Codeigniter! In CakePHP, query are very simple to get value from a table by any field with related data.

Console
Cakephp came with console features. You can generate code or upgrade db schema from your console. If you are working with a team remotely and you don’t allow other user to handle your db directly – you can use this feature.

CodeIgniter doesn’t has this feature.

Validation
In Codeigniter, validation is handled by a validation class. The validation class can also help automate some of the process of setting error messages for specific fields.
In CakePHP, validation rules are defined in Model, can be validate data before save or at saving. I like CakePHP validation, it’s fantastic.

View/Layout
CakePHP handles this fairly well by using a default layout, easy to implement header , footer, sidebar while CodeIgniter takes a very straightforward approach – something like buiding a application from scratch. CodeIgniter allows caching mechanism for your view which is pretty good.

File Uploading
I love CodeIgniter’s file uploading class by which it’s very easy to handle uploading files. CakePHP doesn’t has this.

Other Classes
Codeigniter has many classes such as ftp, compression, cart etc etc classes. You may need certain classes for your project which already in CodeIgniter and not with CakePHP but you may find out component most of the time.

Web Services
Both has web services in built in. CakePHP has REST while CodeIgniter has XML-RPC but both doesn’t has SOAP, you need to find out component/plugin.

Auto Calling Functions/Other Functions
In CakePHP, there are few functions which are automatically called every time you refresh/hit a page and executed if you defined them such as beforeSave, afterSave, beforeRender etc – I just love these. I found a function called requestAction in cakephp that calls a controller’s action from any location and returns data from the action, sometimes its very useful.

Helpers
I found CakePHP helpers(such as form helper, it highlight input field for validation error automatically) are powerful than CodeIgniter.

Learning Curve
The learning curve of CakePHP is slightly higher than CodeIgniter. As CakePHP is a shade of ruby on rails, so its easy to get rails or cakephp developer to get them accordingly.

Support
CakePHP has solid support, you will get your answer very shortly while in CodeIgniter, i am still waiting for a answer in CodeIgniter forum, strange!

Documentation
Both are well-documented so far.

CodeIgniter comes with many classes, less of them are frequently used but missed important classes such as auth, straight forward but no automagic feature, MVC but not strict. I missed these features while i was working on a project using CodeIgniter. You may or may not face few problems while learning CakePHP but once you learnt, I believe – you’ll like it for its automagic, strict convention, faster development and for many more wonderful features.

Notes – This comparison was based on the documentation for CodeIgniter 1.7.2 and having used CakePHP 1.2.

Advertisements

23 thoughts on “CakePHP vs CodeIgniter

  1. Good article. Thanks for the breakdown of both frameworks. I use CakePHP and feel you did a good job explaining the features. CakePHP’s community is very strong. There’s always someone willing to help in the #cakephp IRC channel, and the volume of shared code and information on the CakePHP Bakery and on Github and various social coding sites is just amazing.

  2. hello every body,
    i am learning codeigniter but i faced a lot of problems. I am new its really deficlut and less tutorials on the web. now studying these comparison i want to learn php. Is it easy than Codeigniter, and also tell me best tutorial of Cakephp for biggeners? thanks

  3. Dude.. I’ve try both ingredients… and I found Codeigniter is the way of life..

    You put an afford to learn CakePHP is equal like you learn Linux command.. pain in the ass..

    CakePHP is good at features no doubt.

    but I don’t like things to complicated.. that why I choose CodeIgniter over Cake.

    • Powerful things are always complicated, most of the time we can’t get the facilities powerful stuff has. Bottom Line is, you should go with what you feel comfort best.

  4. A good comparison, especially for those like me who want to learn to use a good framework..
    I have not used any frameworks before and I’ve decided to use from now on..
    It looks like I will have to choose CakePHP 🙂

  5. i have been using cakephp for may years and love it, however one point that should be mentioned in your article is performance. CI is much faster than cake. if you are choosing a framework for features then go with cake. if you want performance or an easier learning curve then go with CI.

  6. I used CodeIgniter for all my projects till a project came that should be done using Cake.
    Both Good.For a beginner CakePHP is not recommended.But if know CodeIgniter then u should go for Cake.I am sure u will love it.

  7. Hey,
    Really a good comparison.
    I Recently started with CodeIgniter and found it very neatly documented and the WIKI for video Tutorials is really amazing.
    Had tried Cake php some time back, found it bit complicated… 😦 , But May be After having a good hands on CI, will again try Cake… May be I like it …..

  8. Nice comparison.. For me cake has a lot more advantage than ci, I love cake anyway. No Offense! Thus, person who like ci than cake are mostly beginners and afraid on console 😉

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s