Read the latest web development and design tips at Fred Wu's new blog! :-)
Poke me on GitHub

Notes on Choosing a PHP Framework: A Quick Comparison of CodeIgniter and Kohana

Update: There is now a more recent comparison of CodeIgniter 1.7.1, Kohana 2.3.1 and Yii 1.0.3.

When I was reading through my subscribed feeds I came across this post: Notes on Choosing a PHP Framework: A Comparison of CakePHP and the Zend Framework by Chad Kieffer.

Chad has done a great job comparing the two frameworks that he’s interested in. That inspired me to write something up for the frameworks that I prefer and use. :)

I began hunting for PHP frameworks ever since Ruby on Rails hit the street. Coincidentally one of the first PHP frameworks I played with was CakePHP. At that time CakePHP’s documentation was nearly non-existent so I had to seek for an alternative. I did a lot of searches, and researches, and finally I was happy to see CodeIgniter. Its user guide was what impressed me the most, I am sure many of the fellow CI users would agree with me on this one. Because of the excellent documentation, I was able to start working on projects right after I spent a few hours on the user guide! Developing apps on CI was such a breeze! Today, I develop web applications in CodeIgniter, Kohana and Zend Framework. If you want to find out how to use Zend Framework components with CI or Kohana, please read my previous blog entry: Using Zend Framework with CodeIgniter.

From version 1.2 when I first started coding on CI, to the newly released version 1.6.1 it sure is a long way. CodeIgniter has progressed well and gained many web developers’ trust, despite a few glitches. One of which was the spawn of the fork: Kohana.

CodeIgniter had some low periods where developers were all focused on pushing out new releases of ExpressionEngine, their commercial blogging/cms product. Some of the users on the CI forum got frustrated because their bug reports and feature requests were ignored. As a result of that, BlueFlame was born, and later renamed to Kohana.

Kohana is relatively unknown to the public. In fact, most of the Kohana users are ex-CI users or users that uses both CI and Kohana (like myself). According to the Kohana homepage and Wikipedia, the differences between Kohana and CodeIgniter are:

  1. Strict PHP5 OOP. Offers many benefits: visibility protection, automatic class loading, overloading, interfaces, abstracts, and singletons.
  2. Kohana has joined the GoPHP5 initiative. All releases from 2.2 on will conform with this project.
  3. Continues CodeIgniter design patterns. Anyone who has used CodeIgniter will quickly understand Kohana’s structure and design patterns.
  4. Community, not company, driven. Kohana is driven by community discussion, ideas, and code. Kohana developers are from all around the world, each with their own talents. This allows a rapid and flexible development cycle that can respond to bugs and requests within hours, instead of days or months.
  5. GET, POST, COOKIE, and SESSION arrays all work as expected. Kohana does not limit your access to global data, but offers the same filtering and XSS protection that CodeIgniter does so it’s recommended to use colocation services.
  6. Cascading resources, modules, and inheritance. Controllers, models, libraries, helpers, and views can be loaded from any location within your system, application, or module paths. Configuration options are inherited and can by dynamically overwritten by each application.
  7. No namespace conflicts. Class suffixes, like _Controller, are used to prevent namespace conflicts. This allows a User’s controller and Users model to both be loaded at the same time.
  8. True auto-loading of classes. This includes libraries, controllers, models, and helpers. This is not pre-loading, but true dynamic loading of classes, as they are requested.
  9. Helpers are static classes, not functions. For example, instead of using form_open(), you would use form::open().
  10. Library drivers and API consistency. Libraries can use different “drivers” to handle different external APIs transparently. For example, multiple session storage options are available (database, cookie, and native), but the same interface is used for all of them. This allows new drivers to be developed for existing libraries, which keeps the API consistent and transparent.
  11. Powerful event handler. Kohana events can by dynamically added to, replaced, or even removed completely. This allows many changes to Kohana execution process, without modification to existing system code.

As you can see, whilst maintaining a certain level of similarity to CodeIgniter, Kohana does offer some advantages (at the same time, some disadvantages). Let’s take a look at a few quick comparisons. Grading scale: Limited < Fair < Good < Excellent. Please note: if a feature is not available in the distributed package, but is available via 3rd party libraries, I will state that in the comparison. If a feature is available both in the distributed package and via 3rd party libraries, only the official one will get assessed.

Feature Comparison of CodeIgniter and Kohana
Feature CodeIgniter 1.6.1 Kohana 2.1.1 Notes
License Apache/BSD-style new BSD Licenses are similar, although Kohana uses the new BSD license which is slightly more flexible than CI’s modified BSD license.
PHP compatibility 4.3.2+ and 5 5.1.3+ CodeIgniter supports PHP4 whilst Kohana is a stict PHP5 framework. If you are using PHP5 then Kohana offers more OOP and performance advantages. Start from version 2.2 (yet to be released), Kohana will only support PHP 5.2+.
Supported Databases MySQL (4.1+)
CodeIgniter’s longer history ensures us a more widely available database support options than Kohana, although in the future Kohana is likely to support more databases too.
Community Forum
Bug Tracker
CodeIgniter obviously has a much larger community and offers a wiki for community members to share tutorials and code snippets. Kohana on the other hand, has a smaller community, however the developers are actively online on the forum and IRC.
Documentation / User Guide Excellent Limited CodeIgniter is known for its excellent user guide. Kohana is in the process of improving its documentation.
Tutorial / Sample Availability Good Fair Tutorials are available on both of their forums. CodeIgniter has the advantage of having a wiki for easier navigation. Kohana on the other hand, has a dedicated tutorial page for some of the tutorials.
MVC Strict Strict Both frameworks use the same MVC approach.
Modular / HMVC Via 3rd party libraries Built in Kohana is built with HMVC in mind whilst CodeIgniter has some 3rd party libraries such as Matchbox and Modular HMVC to accomplish the same effect.
Conventions Flexible Flexible Unlike CakePHP, both of the frameworks offer flexible convensions. There are some defaults but most of them can be overwritten.
Configuration PHP files PHP files In my opinion Kohana is more configurable than CodeIgniter yet it is simpler (less clustered) to do so! Most of the Kohana configuration files are stored in the system folder, you only copy and paste the ones you actually need to modify, and modify them accordingly. CodeIgniter’s config files are all stored in the application folder.
Database Abstraction Modified ActiveRecord Modified ActiveRecord
ORM (optional)
Both frameworks use the modified ActiveRecord pattern. Kohana has an optional ORM module. CodeIgniter has some ORM and Rails-style ActiveRecord implementation avaliable via 3rd party libraries.
ACL Via 3rd party libraries Auth library (optional) Neither of the frameworks forces you to use a specific ACL mechanism. CodeIgniter does not have one built in, and Kohana has one available as an optional module.
Validation Good Good Both frameworks offer a good built in validtion layer. Kohana 2.2 is planned to have some significant improvements for the validation library.
Caching Limited Fair In my opinion both of the caching features are limited. Kohana offers a slightly more useful cache library that supports file, SQLite, APC, eAccelerator, memcache, and Xcache based caching, with tag support.
Session Good Excellent CodeIgniter 1.6 has improved its session library, but it’s still inferior to Kohana’s implementation. Kohana’s session library supports both encryption and storing session data in database.
Logging / Debugging Good Excellent Both frameworks offer very good logging and debugging mechanisms. Kohana is a little bit ahead thanks to PHP5′s native Exception class and its powerful event handlers.
Templating Native PHP Native PHP Templating is *very* easy for both frameworks. If you can skin WordPress, then you’d have no problems at all skinning CI or Kohana. If you want though, you can still incorporate one of the 3rd party templating solutions such as Smarty.
Helpers Good Good Helpers are usually libraries that used for simple, repetitive tasks. Both frameworks offer a wide range of helpers for handling forms, URLs and dates, etc.
JavaScript / AJAX N/A N/A Both frameworks respect your choice of JavaScript / AJAX frameworks. Unlike CakePHP and Ruby on Rails, they don’t have built-in helpers for any of the JavaScript libraries. This offers more flexibility as well as the use of unobtrusive JavaScript.
Web Services Fair Fair I could be wrong but I don’t think either framework supports (or at least encourages) RESTful design…
Localization Limited Good CodeIgniter has limited i18n support whilst Kohana offers a bit more (timezone / full UTF8 layer, etc).
Unit Testing Limited None * CodeIgniter’s built in unit testing class is very limited. * Kohana as of version 2.1.1 does not have a unit testing class, however it is planned for version 2.2.

The Verdict

I had a hard time deciding which of these two I use. In the end, I chose to use both. Why? Because they each have its advantages and disadvantages.

CodeIgniter is great for small to medium sized projects, especially good for legacy servers which have PHP4 installed. The fantastic user guide made coding in CI very efficient.

Kohana is probably better for larger sized projects as well as projects that need more flexible extensions. PHP5 offers better (proper) OOP support as the foundation, plus Kohana’s several better feature implementation make it a strong competitor to its predecessor.

There is no right or wrong for which framework you use, everyone has its own taste. For me, CodeIgniter’s excellent documentation and Kohana’s strict PHP5 + easy to use are the primary reasons to choose them over say, CakePHP and Symfony. That said, CakePHP, Symfony and other frameworks are all excellent choices depending on your taste and experience. On one hand I envy the Ruby community because they obviously have the de facto framework to work with, on another hand, we have more options hey? :)

Feel free to share your opinion and experiences!

Update log:

- Removed MS SQL support for Kohana (confirmed by Shadowhand)
- Updated cache driver description for Kohana (confirmed by Shadowhand)
- Edited unicode / UTF8 description for Kohana (confirmed by Shadowhand)

  • Digg
  • DZone
  • Facebook
  • Mixx
  • Google Bookmarks
  • LinkedIn
  • Live
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati
  • Twitter

Related posts

Tags: , , , , ,

Comments Section

52 Responses to “Notes on Choosing a PHP Framework: A Quick Comparison of CodeIgniter and Kohana”

Sidebar might be covered by comments ... consider it a feature! ;)
  1. 2

    Nice review Fred :) I hadn’t seen Kohana before. I’ll take a look.

  2. 7

    I think you made a good point here, there is no need to choose only one framework when we could use it both.
    Nice article.

  3. 8

    Kahona is very interesting indeed. I have had frustrations with Code Igniter. Especially the rendering of the $data['var'] to the view file and the $_POST and $_GET.

    as quoted from their homepage:
    GET, POST, COOKIE, and SESSION arrays all work as expected. Kohana does not limit your access to global data, but offers filtering and XSS protection.

    - this is exactly what frustrated me in CI. (

    Seems that everything that I dont like in CI is fixed in Kohana. I have added to my bookmarks and will go back to check it out – definitely. ;-)

  4. 10

    Thumbs up, Kohana sounds interesting, I’ll check it out. PHP devs need more articles like this to make informed decisions without spending their whole lives trying to get the info needed. Where is your subscribe button? Ah found it :)

  5. 12

    Nice article. I just read the docs on Kohana and found them to be very good to excellent. Maybe your review was before the current docs were published. Also, I’m wondering what, besides your familiarity with CI and Kohana, keeps you from just using Zend Framework for all larger projects. It seems to have the most comprehensive API and still has the MVC framework that you find in CI and K. Is Zend not “light weight” causing it to suffer some noticeable performance issues? I’m new to PHP but experienced in .Net and Java with various frameworks including Maverick, Spring, and Webwork so I want to adopt best practices with a proven PHP framework. Thanks!

  6. 13

    The way I see it is: they are all fantastic frameworks. To me, because ZF doesn’t force you to a specific design pattern (you don’t even have to use MVC), it allows great flexibility but at the same time it requires the developer to build the system structure. Kohana and CI both have a great foundation structure you can rely on, so that saves more time and effort for us developers. Plus, in my opinion Kohana and CI are simpler than ZF, so they’re easier to pick up. ZF on the other hand offers more independent libraries for varies functionalities.

    Just my 2cents. :)

  7. 14

    Can I suggest looking at one more framework, the Andromeda Database Framework.

    It take the framework to the next level and allows for the business rules to be put in the database rather than in the “interface”. It has direct integration into SVN, allowing for releases to be pushes from development to production using development standards.

    Andromeda takes a unique approach and defines the database using YAML, as well as the business rules/calculations get placed in the YAML files as well.

    I would highly recommend taking a look. You can find Andromeda at

  8. 16

    Good review… I hope you keep it updated :)

  9. 17

    Thanks Chris, I certainly will. :)

    @Donald: Thanks for the link! Andromeda looks very interesting although it is (sort of) in a different field to Kohana and Zend Framework. Correct me if I’m wrong but Andromeda is a lot more oriented to database driven websites. It generates the database and the entire backend from definition files. I am not sure what impact does it have on portability and extendibility. In Rails they have migration to keep track of database changes, is there an equivalent in Andromeda?

  10. 18

    I can answer your questions to Donald re: migrations. These are not necessary in Andromeda. All you have to do is update the text file that describes the database and Andromeda’s upgrade manager figures out the differences and takes care of it.

    Comparisons to Ruby will be more confusing than anything else, as they are so different its like comparing fish to bicycles. Ruby is all about managing development tasks, while Andromeda is about eliminating tasks and simplification.

    Also, as far as I know, only the smallest static sites have no database on the back end. Andromeda makes this a cornerstone but that is only the beginning.

  11. 19

    Thanks for the comparison.
    I’m at the beginning stage of a project I want to build, and have had a tough time deciding which framework to use. I’ve so far dabbled with CakePHP and Symfony, both of which I found quite difficult to get started with.

  12. 21

    And Kohana has a unit_test module since a little while now. Yay!

  13. 22

    Yeah I actually played around with it a couple of days ago, although I’m not sure if I’ll use it instead of PHPUnit/SimpleTest.

  14. 24

    Excellent reveiw, would be grateful, if you were to update this periodically as both seem to be undergoing a lot of development.

    I would also like to know how different the syntax is between the two, from what I understand kohana, is moving towards its own style.

  15. 25

    Thanks, this was a great article and spawned a good discussion on php frameworks. I was looking for this exact info.

    I have dabbled with CI a little, but I have bought in to the whole php5 oop thing, so I was looking for something that could leverage php5 without worrying about having to support php4.

    I was leaning towards ZendF until I found Kohana. I think I might learn some basics with CI and then run with Kohana. Thanks again!

  16. 26

    @Grant: Syntax-wise CI and Kohana are very similar, albeit Kohana just deprecated the support for ‘$this->load’ in favour of standard PHP object assignment: ‘$var = new Class_name’. There are some other differences too but once you get to know both, you’d find that they’re very similar in most cases.

    @Grant and JNettik: Thanks I am glad you guys liked it. I will try to keep this article up to date. :)

  17. 27

    What about the performance?which one is better?Thanks a lot!

  18. 28

    Zozowang: Check out my other post:

  19. 30

    there’s a built in template class for ci since beta 1.0

    Template Parser Class

  20. 32

    Thanks’ for the review fred. I got your article several days ago to decide whether i wanted to try kohana or not. And i decided Yes :D
    I’ve been just exploring kohana 2.2 today with help of user guide from I think kohana is very impressive (except ORM as i haven’t read that part yet :D). Mostly like CI so the learning curve could be so fast.
    Regarding to speed benchmark (#28) well the gap is not so big with CI.
    I’m wondering if there’s kohana community in Indonesia.

  21. 37

    KohanaPHP is like CodeIgniter with ORM.

  22. 39

    great post, i would be very grateful if you put the background of your blog to some brighter color. black is very beautiful, i agree, but at the end i see strange shapes on the screen. :)

  23. 41

    Very interesting comparison. I am analysing which framework to use for a project that’s just about to start, but disliked the fact that CI enforces compatibility with PHP4. First time I’ve read about Kohana and I am keen to give it a try! Let’s hope their Unit Testing module is available by now. Cheers!

  24. 42


    What are the differences of CI 1.7 and K 2.3?

  25. 44

    i choose CI than Kohana simply just because it had a much better documentation. If Kohana documentation is as good as CI, then i would switch to Kohana immediately


  1. Notes on Choosing a PHP Framework: A Quick Comparison of CodeIgniter and Kohana | Online Services
  2. Web 2.0 Announcer
  3. roScripts - Webmaster resources and websites
  5. ThisLab: Notes on Choosing a PHP Framework: A Quick Comparison of CodeIgniter and Kohana | Development Blog With Code Updates :
  6. Some recent PHP links | Whatsup
  7. Pet Pixels
  8. [網摘] 20080314 « Oceanic | 人生海海
  9. Scegliere un framework php: kohana vs codeigniter » Programmazione Web - il Blog open degli sviluppatori del web!
  10. for PHP freelancers - TalkPHP
  11. Refreshingly Blue » Blog Archives » Ecommerce with CodeIgniter
  12. Kohana - Framework PHP pengembangan dari CodeIgniter
  13. Kesan Pertama Mencoba Framework PHP Kohana : Agak aneh dibanding CodeIgniter ? « Let’s Go Green !
  14. Best PHP Framework / PHP Frameworks Comparison | Mahmoud M. Abdel-Fattah
  15. Daily Find #101 | TechToolBlog
  16. links for 2008-11-06 — Resurgence 2.0
  17. Kohana « Fiji Ecuador Seattle Greece Montana
  18. Rob Searles » Blog Archive » Kohana PHP Framework - My Thoughts
  19. » Blog Archive » PHP框架选择 | 技术、生活、感悟 — Laoer的博客
  20. Choosing a PHP Framework Round 2: Yii vs Kohana vs CodeIgniter | Beyond Coding
  21. The importance of a well-documented framework | jigniter™
  22. Не лошата алтернатива Kohana
  23. Choosing a PHP Framework Round 2: Yii vs Kohana vs CodeIgniter | PHP Frameworks
  24. Mengenal Kohana « Online Journal of Leni
  25. Perbandingan Codeigniter & Kohana ( PHP Framework ) « Asepspmn’s Weblog
  26. Choosing a PHP MVC Framework: Yii Vs. Kohana Vs. Home made MVC | Jorge Albaladejo
  27. Choosing a PHP Framework Round 2: Yii vs Kohana vs CodeIgniter