share
Stack OverflowKohana or CodeIgniter?
[+72] [17] Thinker
[2009-04-04 21:18:00]
[ php codeigniter frameworks kohana kohana-3 ]
[ http://stackoverflow.com/questions/717836/kohana-or-codeigniter ] [DELETED]

I'm looking for a PHP framework. I've done some research, and found CodeIgniter [1], which is attractive. I then discovered that there is Kohana [2]; that is based on CodeIgniter. I'm annoyed, because since Kohana is based on CodeIgniter it should work similarly. It is optimized for PHP 5, so it should be faster in a PHP 5 environment. I was going to choose Kohana, and then I found benchmarks that points to CodeIgniter as the faster one. I don't understand it. If Kohana is updated more frequently, and optimized for PHP 5; shouldn't it be better benchmark wise? I'm experienced PHP programmer, but Smarty [3] is the only framework I have worked with, and I don't want to waste next few months learning a lesser framework.


Thanks for your replies. I will give Kohana a try.

Was there a reason why you picked CI among all the PHP frameworks (e.g. Zend, CakePHP, etc.)? Just curious :) - codingbear
Mainly performance, but also comments read all over the web. - Thinker
(2) FYI, smarty is not a "framework", it is a library that serves as a template engine. - wilmoore
Why decide between those two? There are many more frameworks you can consider. - hakra
[+60] [2009-04-04 21:45:20] GeekJock [ACCEPTED]

Kohana is a huge improvement over CI, but suffers from lack of exposure (for the time being). Kohana has a modular architecture and clearer class definitions than CI. Also, because Kohana is maintained by the community, development is more active.

Kohana does consume more memory than CI, but execution time is nearly the same. This [1] article has some interesting benchmarks.

Also, see Exploring Kohana as an alternative to Codeigniter [2]

EDIT: Kohana 3 [3] is available. Handy HMVC [4].

[1] http://www.beyondcoding.com/2008/03/25/kohana-vs-codeigniter-speed-and-memory-usage-performance-benchmark/
[2] http://onwired.com/blog/exploring-kohana-as-an-alternative-to-codeigniter/
[3] http://v3.kohanaphp.com/
[4] http://kerkness.ca/wiki/doku.php?id=hmvc_in_kohana

(27) 1+ Kohana over CI - Sepehr Lajevardi
That article on onwired.com is very good :) I will use Kohana then. - Thinker
thanks for the onwired link. - Thorpe Obazee
(1) The onwired article is, indeed, a good read, but it was written in 2008. CodeIgniter is now on version 2.0.2 and I've been using it for a few months and am loving it. You can easily leverage components of Zend and other larger frameworks, while keeping your main development framework lean and mean. I highly recommend it. - Kyle Noland
(1) @KyleNoland yeah, and Kohana is now 3.2 and like 3 years ahead of CI (3.3 on its' way) - Kemo
Overall, I find questions like these difficult, because as demonstrated here above me, things change. Frameworks get updated and the answers not always. There should be some sort of expire date on topics like this or outdated answers as seen a lot below. - bottleboot
1
[+40] [2009-12-15 11:23:28] Phil Sturgeon

It's worth noting that Kohana has since been totally re-written. It started as a fork with minor tweaks but now only shares similarities to CodeIgniter, and should not be considered "an improved PHP5 version".

CodeIgniter is quick, backwards compatible, well documentation, well tested and has a massive community.

Kohana is optimized for PHP5, allows slightly cleaner code but is let down by its documentation and community. Documentation has recently been released and it is great quality but until then it's all been guesswork. Their community is not bad, but it is not as big as CI's.

If you are fairly new to PHP, OOP or MVC then go with CodeIgniter as it will seriously smooth the transition. If you are a MVC, OOP KING then give Kohana a try and see which you like better.


(7) I've just looked at the documentation and tutorials for Kohana, and like Phil, I was not that impressed. - Julian
(1) Take a look at Fuel, we already have more documentation that them and it's growing daily. github.com/fuel/fuel/wiki - Phil Sturgeon
Got some proper documentation in place now fuelphp.com/docs - Phil Sturgeon
(2) I can't really agree with this. I'm not sure on what you based this. But the documentation of Kohana is quite complete: kohanaframework.org/guide kohanaframework.org/guide/api - RJD22
(1) RJD22: Sure now they have great documentation, but it has only be released very recently. - Phil Sturgeon
This thread peaked my interest in Kohana as regular CI user. I don't find the docs that good though. I really want to try it. Things like this are not convincing me though: kohanaframework.org/3.0/guide/auth/user - bottleboot
Yea... real great documentation. Look at their ORM validation docs. kohanaframework.org/3.0/guide/orm/validation - Peter
Yeah im pretty annoyed about the lack of ORM documentation, but it's a non-core package so doesn't apply to the same rules as core features. - Phil Sturgeon
2
[+31] [2009-11-11 20:44:17] wmid

I like the Kohana syntax better than CI. To use a model in CI, you have to load it first:

$this->load->model('model', $modelname);

In Kohana, it's familiar OOP syntax:

$modelname = new Model();

Also, using helpers in Kohana is more intuitive. In CI you have to load the helpers, like above, then each of that helper's methods is usable, but I don't like that the methods become global and don't indicate a namespace of sorts.

CI:

$this->load->helper('email');
send_email($to, $subject, $msg);

Kohana:

email::send($to, $from, $subject, $msg);

Kohana make sense than CI :p - ilumin
(2) PHP 5 makes more sense than PHP 4. - Phil Sturgeon
3
[+22] [2009-09-21 09:12:57] stef

I really don't want to be a party pooper but I don't think PHP4 / 5 support / speed or the auto loading feature being a PHP4 hack and whether or not it maintains singleton classes really is that relevant.

It seems the real pro's, who actually know what the above means and can demonstrate the differences between PHP 4 / 5 speed and pinpoint where and why in the application this effect is caused, would use more enterprise frameworks like Zend or Cake.

Speed of the app – unless you are trying to make your app slow, any php framework will deliver decent enough speed for small applications. Only if you're on a site with 10.000's of users per day will this start to matter.

I have only experience with CodeIgniter and I use to build small/midsized company websites and intranet applications because :

  • it allows me to do so quickly
  • keeps code clean via MVC
  • documentation is the best i've ever seen
  • usually things work exactly as indicated: very few bugs or quirks

All the technical nitty gritty is not really that important.

The community "model" – I'd much rather have a bunch of core-guys from Ellislab who communicate clearly and honestly and release code that works perfectly 99% of the time, than a model like Drupal's where anyone can upload a module and you discover 3 months down the line it actually doesn't work at all like it should, no support it available and you're fcked.

So concluding, I would say go with CI if you want robust documentation to help you deliver your product on time. If you're really good with PHP and like experimenting and digging in the code, then try Kohana.

Best of luck!


(2) Why would you call Zend or Cake enterprise frameworks? From what I've read, they're bloated and inflexible. They do have a lot more features, but why not just use libraries to get what you need? - Burton Kent
Zend inflexible? It's super-flexible - it's a set of independent libraries. Kohana, Cake, Symfony etc. are inflexible, yes, but they give you things working out of the box - Zend does not. - Damian Nowak
(1) FYI, the comments about ZF being bloated are a form of cargo cult. You hear it a few times and it becomes gospel. It is not bloated. The term framework for ZF is a misnomer as it is really a library of use-at-will components. In other words, you can use the log component without the MVC component. ZF is VERY flexible...so flexible that it can be off-putting to developers don't understand some of the pattern it employs. That is going to be the case with any framework in this class -- I would put Rails 3 in that class, though it does a slightly better job of getting you going if you are new. - wilmoore
4
[+16] [2009-04-04 22:12:55] rick

I've used both, and imo Kohana betters CI in all aspects except documentation. That was Kohana's objective from the start: improve CI.

The single most important reason to choose Kohana, imo, is autoloading. The CI loader is a php 4 hack. It loads and maintains singleton classes. The caller, not the loader, should determine if a class is a singleton. Furthermore, if a class is meant to be a singleton, it shouldn't expose a constructor. If you want to call a static method in CI and you use the loader, a class instance will be created - how unnecessary. Not to mention, I hate having to write: $this->load->library('myclass');

Edit: One future advantage of CI, maybe its salvation, is Expression Engine 2.0 CMS. Since EE 2 is built on CI, a CI user will be able to easily integrate and extend the CMS.


5
[+9] [2009-04-04 22:32:25] Jayrox

I started out with CodeIgniter and have used it for a little over a year now. Then a month or so ago I started reading about Kohana and decided to give it a try. I ported all of my code base to Kohana and started messing around with it. I have since gone back to CodeIgniter, however I did keep the Kohana branch just in case I ever want to go back.

The main reason I went back was documentation is terrible on Kohana compared to CodeIgniter.

I really didn't find a real staple reason to stay with Kohana.As for speed seemed fairly consistent between both frameworks. Neither seemed any easier to code against.


(3) Kohana documentation is fine. You just have to look a little harder to find it. - GeekJock
(4) I agree with Abi. That was my initial reaction to Kohana's docs. As they always say, the code is the best 'documentation' ever. But with a lot of people now contributing to the docs, I think the Kohana documentation has come a long way since. - Thorpe Obazee
(22) CodeIgniter documentation is very good which is a clear benefit. Kohana would appeal to more users with better docs. "have to look a little harder to find it" is not a feature. - pbreitenbach
(3) "have to look a little harder to find it" is not a feature. -- agreed. - jmccartie
Perhaps things have changed in the last 21 months, but it took me only a few seconds to find the Kohana docs. kohanaframework.org/guide Edit: …and then only a few more seconds to find that it has enormous gaps. - rspeed
6
[+6] [2009-04-04 21:58:18] Eli

I didn't use CI for very long before switching to Kohana, so I can't say much about it, but I did like Kohana a lot better. It just seems to make more sense.


7
[+5] [2009-04-04 22:20:25] Mario

Kohana is optimised for PHP5, as in it takes advantage of the PHP5 features such as autoload, it is not necessarily FASTER than CI in PHP version 5.

If you are worried about the performance, at the execution speed level, just build a script that puts ALL your PHP files (classes, etc.) inside a single PHP file and use eAccelerator. The lag will be cut down by a 100...


(7) If you're worried about performance, why are you using PHP? :) - dirtside
(11) I'm simply suggesting a way to optimise a common flaw in PHP frameworks, which goes along the nature of the question asked by the author. Blindly suggesting to move away from PHP due to bad performance is irresponsible and lacks insight. - Mario
(21) dirtside = troll. - jmccartie
8
[+4] [2009-04-04 21:22:28] Mark

Not entirely certain, but I would suspect CodeIgniter has a larger community than Kohana. That's probably reason enough to go with CI and ignore any subtle differences in speed.

You might also want to take a peek at CakePHP if you haven't already. I think it's a little more bulky than either of those two, but more featureful.


(7) Cake has an entirely different philosophy than CI or Kohana. I don't think that someone interested in those two would be a good fit for Cake. - rick
(1) I know, I'm just saying. It's worth investigating all possibilities first. If he did, and decided on CI, then great. - Mark
[ I would suspect CodeIgniter has a larger community than Kohana. That's probably reason enough to go with CI and ignore any subtle differences in speed.] CodeIgniter has been heavily advertised as easy, accessible, simple, light footprint, etc. So, it has appealed to lots of developers at that entry level. Quantity, just like speed, should not be a key criterion for choosing a framework. I'd rather take advice from 1 experienced Kohana developer than 10 from CI. I know this because I've been in both communities. - mike
Fair enough. I was mostly just speculating :) I find every framework has some little quirk that bothers me. - Mark
(3) I would much rather there be 10x more developers than a small quality advantage. To each his own. - pbreitenbach
9
[+4] [2011-01-20 21:55:46] dnyce

This may be a bit late, but you should also take a look at FuelPHP [1]. It was created by a few of the developers that have made major headway with Codeigniter. It seems to take the best of Kohana, CI, and even theory from Rails and puts it altogether into a nice package. But at the end of the day, if I had to choose a framework right now, I would go with Codeigniter. If only for the more active community and the fact that they now have a separate branch that will allow for edge case updates (Reactor).

[1] http://www.fuelphp.com/

10
[+3] [2009-07-04 00:02:59] pbreitenbach

Kohana sounds very promising as it aspires to fix some of the shortcomings of CodeIgniter (mainly taking advantage of php5). But its evolution has been a disjointed. CodeIgniter is currently quite a bit more stable (not talking about bugs), has better docs and seems to have a more judicious designer behind it.


11
[+3] [2011-04-17 11:35:50] Joe Yang

Kohana is a better choice if you use PHP5.

Kohana has better document, I found it has detailed API reference, which I haven't found in CI (CodeIgniter). Also, it result in beautiful API, and may be also performance, since Kohana used PHP5 feature.

Regarding the legacy community, it is only the time issue, I see Kohana is very active, it evolves to 3.1 currently, but CI is still in 2.0, it denotes the framework attract a lot of people using and improving it. So don't worry about the community.


12
[+3] [2011-04-29 03:26:56] Ajay

Somehow I like CodeIgnitor over Kohana in terms of understanding.


13
[+2] [2012-01-29 12:30:12] tomexsans

I tried C.I its cool, the framework is well documented and you can find tutorials anywhere on the web be it PDF, Video,source codes name it you have it. Unlike Kohana if your a beginner. You will really need a beginners luck. Documentation is not that good. but for the record i like Kohana, i just switched with it.


14
[+2] [2012-03-10 07:36:03] Sinan Eldem

It takes some more time to learn Kohana because of less documents and samples but it is exact that Kohana is a really faster than Codeigniter.


15
[+1] [2012-03-27 10:14:00] Mrigesh Raj Shrestha

Kohana is a huge improvement over codeigniter. I have been using codeigniter for more than two years now. But major improvement in kohana is its strict OOPness. Its a huge benefit in terms of memory usage as well as solution outlining for problem domain. Who doesn't know about dealing Real World Problems via Object Oriented Concept.

You can benefit from various new features of PHP5 like static objects, Inheritance, Auto loading (that makes loading php classes seamless and hurdle-free as well). Besides Kohana just blends in with today's best opensource IDE for PHP i.e. Netbeans. Code folding, code suggestions all work fine. Cascading Filesystem Principle in kohana is just awesome.

Only drawback is the documentation. I could hardly follow the documentation at start. Kohana keeps in as a module and we have to enable in bootstrap.php file. Even the link for user-guide is not available properly. For instance, user-guide is biggest boon in-case of codeigniter.

I am using http://www.packtpub.com/kohana-3-0-for-professional-web-applications-beginners-guide/book for grasping kohana. Less authors have written about it. This book gives gr8 vision about the new term HMVC. Codeigniter supports emulated HMVC. Some hacks has to be added to attain that. But still codeigniter won't be able to harness true power of HMVC with current codebase they got. I wish I could give library.nu URL for the book to you; its closed now.

I know there are many gr8 answers before I posted here; but still if its about supporting kohana and boo-ing codeigniter, why be left behind. :D


16
[+1] [2012-06-04 18:23:57] Peter

I've been working with both everyday at work for a over a year now and it all comes down to maturity.

With CodeIgniter I find that it is;

  • Easy to get things done.
  • Simple to extend (HMVC, ORMs, ETC) \
  • Usable documentation and easy to find help.
  • Very snappy speed.
  • Clean application structure, everything has its place.
  • Wealth of Libraries and usable examples.

With Kohanna... I liked;

  • Built in ORM is easy to use and extendable.
  • Integrating memcache is a breeze.
  • Having everything OOP is rather nice in a large scale application.
  • Built in HMVC is a great timesaver.
  • Very verbose profiler.
  • Pretty quick framework.

But Kohana has a major failure.......

The documentation is complete trash and might as well be removed.

If your planning to build a serious product that you need to depend on, Codeigniter will make your life easier.


17