Posted by Fred Wu
It was over a year ago that I wrote the article that compares CodeIgniter and Kohana. Since then both CodeIgniter and Kohana have seen major progress with the release of CodeIgniter 1.7.0 and Kohana 2.3.
In December 2008, a new PHP framework called Yii has been released to the public with a stable 1.0. There were a lot of new PHP framework released in 2008, but Yii was one of the more recognised ones because:
- The author, Qiang Xue, is the author of the well established PRADO framework.
- It is a simple to use, well organised, PHP 5 only MVC framework.
- It claims to have astonishing performance.
Before I start this round of comparison, let me briefly list my experience with these frameworks, so you may interpret this article with your own judgement.
CodeIgniter: I started using CodeIgniter since its version 1.2.x from a few years ago. During the past few years I have worked on projects mainly using version 1.5.x and 1.6.x. I have now stopped using CodeIgniter in favour of using other PHP 5 only frameworks.
Kohana: I first started using Kohana when it was called BlueFlame back when it was first forked out of CodeIgniter. Since then I have lurked and participated in the Kohana community. All of my recent projects are done in Kohana.
Yii: The 1.0 release of Yii had my attention, but I didn’t really dive into it until about now. However, most of my impressions on Yii are based on its documentation and this article by Daniel.
Let’s see how they compare with each other.
Same notes as before: Grading scale: Limited < Fair < Good < Excellent. 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.
I currently use my own custom framework that is built on top of CodeIgniter 1.6.3 (with zero modifications to the CI distribution). I’ve been evaluating Kohana as the next major progression of my framework, and had an initial working version, but I’m waiting on v3.x to make the switch since it’ll bring tons of changes over the current v2.x codebase, and I don’t want to have to migrate twice. Going to check out Yii now…. who knows, maybe it’ll take the place of Kohana for me. :-)
There is a Kohana module that provides templating – check out Temper in Kohana projects. You can extend it with your one tags.
I would add that Kohana does have a unit testing module in the SVN repository but it isn’t distributed with the standard download builds. The unit testing module performs all the basic testing requirements, but of course being Kohana you can extend it to your own needs.
Kohana has a unit test module in SVN
Kohana ftw! \o/
Thats funny… I could have sworn that there were a bunch of web frameworks for ruby… (A quick google turns up a bunch of lists of them, here is 7: http://www.juixe.com/techknow/.....rameworks/ )
@coolfactor: Yeah, I’m doing the same, but on top of Kohana. :)
@Howie: Thanks for the heads up!
@Sam & spirit: Thanks for the heads up, I actually know the unit testing module is in SVN. I opted to include the ones only in the distribution though. I’ll update the post anyway. :)
@Martin: Well, yes and no. A good developer should know when and where to use the right tool.
@SeanJA: Yes, there are many Ruby frameworks, but Rails is still the dominant player in the field. There is no equivalent PHP framework that has this status.
I’ve tried all 3. YII’s lack of tutorials really turned me off and wasn’t quick to get a simple project off the ground from what I remember. I’ve been really playing with Kohana, it just seem much nicer than the rest to deal with. I do wish there were more tutorials, but the one (Kohana 101) is pretty good.
The Yii’s benchmark is extremely unfair. It’s like comparing the noise a scooter makes, to the noise of a Harley Davidson. Sure it’s going to be quieter, but I sure as hell know which one I’d rather drive. Plus the code looks messy and uncommented. The documentation looks nice though, and I like the ability to comment on it.
Thank you for the informative review.
I find that CodeIgniter’s lack of features is largely made up by the large community surrounding it. CI may not have a built-in auth class or ORM library, but there are many to choose from out there, giving CI more of a community-development feel (just like Kohana!).
What I look for in a framework is a small, flexible footprint with the ability to easily add plugins and extensions. I do wish CI had an official extension repository like WordPress where developers could go to add features to the framework on-the-fly.
How can a framework be delivered without test suites to test its core, to make sure its quality or its compatibility on user environment. I wish Kohana provide it just like Ruby on Rails does.
Well, I’m using Yii and I can’t tell there is lack of information on it. Yes, there is no hundreds of tutorials, but it has excellent documentation and very active support. I don’t remember when I asked a question and got an answer in more than 3-4 hours. I’m using it for the large application and it suites me completely :)
Hi there,
I’ve used codeigniter, kohana and yii for the last year or two, so i thought i’d share some of my insights too.
If i need something done right away, I would use Kohana. I know where everything is, and how everything’s done. Kohana’s cascading filesystem is very flexible when it comes to configuration and modules, to the point where it’s almost like it’s an analogy for OOP. Your base configuration is used unless overwritten by your custom ones.
I have been struggling, but slowly getting through yii. Kohana’s closer to CodeIgniter, but yii takes some getting use to, especially coming from CI heritage. It’s a journey of discoveries. I’ll be working on a Kohana project, thinking, it’d be cool if I had this. I’d look through yii, and lo and behold, it’d be there.
Example: How to restrict access to particular actions of your yii controller.
—————————–
Step 1: Use the accessControl filter
in your controller, put:
public function filters(){
return array('accessControl');
}
Step 2: Define access rules (note: this is convention over configuration. they assume you know to put this method in so the accessControl filter would know where to look.)
public function accessRules(){
return array(
array('allow', 'actions'=>array('list', 'show', 'captcha'), 'users'=>array('*'),),
array('allow', 'users'=>array('@'),),
array('deny','users=>array('*'),),
);
}
—————————–
I agree with you totally. There is a LOT of good things in yii, and that’s my motivation for learning it. Because it’s autoloaded, there are lots of little things you can put into the core code without slowing down the code. This is both its strength and its weakness; the more extraneous classes they sneak in, the more bloated the documentation will become. Ruby on Rails became famous with its “convention over configuration”, and yii is heading towards that direction too. But this will only help the people who already know or follow the convention. Without good documentation (ie. not a class list), yii’s learning curve will remain high enough to discourage people from joining the community.
Symfony is strictly PHP5 too. It has been since the very beginning. And it has excellent documentation.
Thanks for the interesting post.
I’ve just started using CodeIgniter recently and I’ve loved it so far, but I’ve decided to try Kohana for my next project for a few of reasons:
i) Kohana uses strict PHP5 OOP.
ii) Kohana has a much better session library (although this looks to be a decent replacement for CI’s offering).
iii) Kohana includes an Auth module, something I found lacking in CI (I know CI is a barebones framework, but user access/authorization is needed in so many websites that the functionality should be included in the framework I think).
The one thing I think so far that Kohana is lacking is more documentation. CI’s documentation was a major reason I decided to use it in the first place, good documentation is a strong selling point.
Thanks to this post I’ll also be taking a look at Yii as well, it sounds like it has some promise. Seems like a new PHP framework is born every month!
Thanks for writing this comparison. Look forward to hearing more about your experiences with Yii.
I have been using Kohana lately after trying many PHP frameworks. CI is good and I used it when it first came out, but it hasn’t evolved enough for my liking.
Competition is good though and I’ll be trying Yii soon.
As a side point, I really like Django’s easy to set up admin area. This is something I wish more PHP frameworks would offer. Symfony does, but it’s more geared towards larger projects.
Hi. it would be very interesting adding the new FUSE framework compared to Yii and Kohana … I believe those 3 frameworks are the best available nowadays for PHP development.
Paul M. Jones has pointed out that ab, results from which comprise the cited Yii performance benchmarks, can generate misleading output.
http://paul-m-jones.com/?p=413
Kind of interesting that Symfony hits just about every section in this breakdown pretty well.
Unit & Functional Testing: Great. Built In and documented
Internationalization: Great. Built In and documented
Web Services: Not sure about that one
Bundled JavaScript: Meh. Prototype/Scriptactulous
Helpers: Great. 20
Templating: Good. Has it’s own
Logging / Debugging: Excellent, has a great debug mode.
Session: Excellent. Good session class, supports flash data and is well documented.
Caching: Excellent. Built in caching system that works extremely well and is well documented.
Validation: Excellent. Since 1.1 they have redefined their form handling and validation. It is one of the easiest systems to use and is very well documented.
Auth and ACL: Excellent. Built in support with sfUserGuard. There are also plugins to extend the class.
Database Abstraction and ORM: Excellent. You can use either Propel or Doctrine. Both are full featured and easy to use.
Configuration: Excellent. Almost everything in Symfony is configured with YML making it very easy to turn settings on and off. Even the auto-generated admin pages can be mostly configured with just YML files.
Conventions: Excellent. Everything can be overwritten or configured.
Modularity: Excellent. Same as Kohana, it is built on modules and cascading file systems.
MVC: Yes. Events, Plugins, Helpers, Hooks, Modules, and Widgets.
Tutorial / Sample Availability: Excellent. They teach you how to build a complete web-app in 24hours. They also have a cookbook section and code snippets.
Documentation / User Guide: Excellent. They have an API, an online book called The Definitive Guide to symfony, symfony forms in action, symfony and doctrine, and Practical Symfony (which is just the web app tutorial in book form).
Community: Good. They offer IRC, Forum, and 2 Google Group mailing lists (1 for developers, 1 for users).
Supported Databases: Excellent. All the DBMS supported by PDO
PHP Compatibility: Requires PHP >= 5.2
Licensing: Excellent. MIT
All in all, not saying that symfony is the greatest framework ever, but I would probably take a look at it if I were you. It seems to hit everything except web services really well. May have sounded like a fanboy there but I thought it would be interesting to see how symfony stacked up in your chart.
XDD KOHANA RULZ MY FRIENDS!!!
O_O my combo is kohana + jquery
Let’s try CodeLighter – its a simplified CodeIgniter-like framework:
http://code.google.com/p/codelighter/
please compare symfony too … I think symfony is the best framework available
One thing to consider also is Kohana 3, it’s almost a new framwork when compared to Kohana 2 and thus, to me, it is a game changer. Fully integrated HMVC, and an integrated REST controller, to me, it would be hard for Yii to catch up any time soon, and it has left CI in the dust back in the first 2.0 release.
Symphony is fine, but too monolithic and bloated, imo.
Thanks for this great article, got me interested in Kohana for sure
Hey nice writeup. I found this on Dzone, seems another ~new framework. http://doophp.com/
I gone through the demo it seems to have nice routing support for REST. It’s lightweight like CI which I think I am going to replace CI with this :)
Symphony is really.. bloated, I would just use Zend components with the other framework like doophp or yii
We just finished a Massive custom cart system (1 1/2 year build)using Kohana.
Kohana = Wonderful php programming.
Thanks for the post, really got me thinking about which framework I’ll be sticking too…
You should throw in some performance comparisons between the three frameworks just for kicks! Such as repeated database access, caching and non caching comparisons, maybe even the ultimate (which I have yet to see) how long it takes to develop a particular application under the different frameworks which has the same appearance and functionality.
I’m half way through coding a very complex website with some crazy supertype/subtype DB relationships and a bit of EAV thrown in too… Any other framework and I’d be writing custom modules to beat the band however with Kohana’s ORM it makes it so easy. Not to mention the session control, auth etc.. it makes writing PHP a joy again (and after 8 years of it I never thought I’d say that again!)
Why do you compare the loosers? Dont try any PHP frameworks but Symfony…Trust me…
Try Finding a hosting service that has Ruby On Rails enabled and tell me that it’s better to use it rather than use a PHP framework
Having worked with NetBeans / Ruby on Rails, I found the move to a PHP framework conceptually easy, but a bit daunting due to lack of good IDE support. I must say however, that after preliminary exercises (TestDrive) in Yii, that the command line framework instructions are not a real barrier. I’d like Yii to generate tables like RonR does, but hey, you can’t have everything! Why Yii? Because I need a PHP framework for interoperability. AS for the “gems”, I’ll have to live without them while using Yii.
Steve B
Business Geeks (Australia)
If anything, Yii is better than Kohana because unlike with Kohana you can actually use Code Completion in Eclipse PDT and Net Beans with it.
I made a detailed post on this at Why Yii Framework is Better than Kohana.
Also, I’ve made a less detailed but much wider comparison of a few other PHP MVC Frameworks at Choosing the Best PHP MVC Framework. This is part of a series of posts that I’m going to do on this topic as I spend considerable amount of time doing this for myself.
I have used CI since I have, because I had PHP4 on FreeBSD. Now I am trying to use Yii to another project, since PHP5 becomes a standard. In my experiences, CI is extremely easy to use, I start to develop my project within a few hours. However CI is lack of some common features like Authentication and Authorization, I choose Freakauth as final solution. The reason why I leave an easy solution like CI, because I failed in integrating OpenID services into the CI. So I started to search for alternative PHP5 frameworks.
While Yii has many features, however, it absolutely requires more effort to understand how it works, especially I am not familiar with OOP programming in web development. It has much complex asset managment registration classes, not simply copying your JS/CSS into one specific folders. But I believe Yii can move on, since Yii is the youngest one among three frameworks.
Very nice article! We’re actually in the process of selecting a framework for future projects. Our selection consists of the following: Code Igniter, Kohana, and Recess. From what I gather, there seems to be a lot of interest in Kohana vs. the rest. I’d like to read more reviews like this.
I’ve been using Kohana for at least 1 year because it is one of the easiest frameworks to use.
Documentation is a little bit outdated but you don’t need much to start using it and create your first application. Just follow the Kohana 101 tutorial and you will be ready to go.
In addition to this the core is really small which makes Kohana very fast.
In the past I used Symphony to develop my applications, but I got bored of setting lots of files and the low performance it provides.
good article, Thank you!
I recomend yii right now to try. With current 1.1.4 version it have code generation feature, strong AR etc. Currently I develop one project with it and when I finishit I will anouce here…
regards
I’ve been using Yii for about 6 months and I think it has some excellent features. It’s purely OO, architecturaly clean, AR, scopes, validation, very simple to extend it. I had my first webapp written in it running in 1 hour.
It has good docs (you just have to take some time reading it!) and pretty large community. We’ve been using it on a large project (a portal). Also, there is embedded unit testing provided (using phpunit), bundled jquery (with UI widgets), json, and all other web 2.0 stuff. In the book you even have TDD approach described with yii. All in all, we’ve been satisfied with it.
I used CI , now I’m in love with yii.
For me, YII has superior features for a OO Programer and the programing by testing.
Is very simple, if you like use OO code and need have REAL OBJECTS in your code you SHOULD use YII, don’t waste your time with CI.
I think this Framework round should include the evaluation of the “programing style”, CI has a unique style, but YII is total OO.
All I can say is the choice is really simple, 6 points to note.
Have a look at this and choose for yourself http://www.christofcoetzee.co......vs-others/
Yes yii’s documentation leaves alot to be desired. But to be fair. If you can’t understand the class view, then maybe you should try an easier framework(if this is possible because imo Yii is simple and im terrible) Anyone who knows oop should pick up yii in a few weeks and then move from there. With regards to unit testing yes YII does come bundled with phpunit. You need to extend the CDbTestCase class. Hope this hope.
CodeIgniter 2.0 removed support of php4
turkish users can check my review about yii framework.
http://www.erkasoft.com/yii-framework-incelemesi/
I have looking for the latest into about PHP framework and I found this site. I tried CI but not that interesting. I will give Yii a try. Thanks for the comparison.
I will test Yii these days.
CodeIgniter has a very limited and poor support for unit testing or any test.
Yii has code generator that looks promosing, it may accelerate develepment.