Friday, December 23, 2011

CakePHP vs CodeIgniter

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.

3 comments:

  1. Awesome post. Sharing it on my Pinterest and @ishouvik Twitter account ...

    ReplyDelete
  2. Informative Blog

    Thanks for Sharing !!

    ReplyDelete
  3. Cakephp is really an amazing e commerce development platform. One must cakephp development for building applications for his business as cakephp development various benefits and features.

    ReplyDelete