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.
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/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.
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);
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 :
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!
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.
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.
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.
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...
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.
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/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.
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.
Somehow I like CodeIgnitor over Kohana in terms of understanding.
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.
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.
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
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;
With Kohanna... I liked;
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.