Kohana: more than just a fork of Codeigniter

For a while now I’ve used EllisLab’s Codeigniter for quite a few projects. More recently, I’ve turned to Concrete5 as it allows both myself and my clients to edit “in-place” resulting in fewer support calls for me. However, I’ve still had a soft spot for Codeigniter as it does, indeed, allow for Rapid Application Development. But I’ve been using is long enough now to understand many of it’s foibles.

I made the mistake of forking my Codeigniter install early on as I wasn’t familiar with the framework and didn’t quite know how to get it to do what I wanted it to. This was a mistake as couldn’t then apply the security patches that EllisLab released, instead, I’d have to make them myself (although, I rarely did).

Recently, a friend of mine put me on to Kohana which is a fork of Codeigniter that is, in my opinion, fricking awesome. Imagine all the things that aren’t quite right in CI and Kohana has fixed them, including being more OO PHP (according to the website, it’s STRICT OO PHP!). It’s secure, lightweight and things you’re used to working with still work. CI removed the $_GET, $_POST and $_COOKIE vars for security, but it was a little irritating, Kohana puts them back. It uses autoloading and appropriately name classes. There are static classes, methods and objects where neccessary and it uses a cascading load heirarchy similar to CI, except this works. It looks for the thing you’re trying to load first in your “application” directory, then your “module” directory and finally, if all else fails in the core “system” directory. Sweet huh? Also, the event handler responds and reacts better as it’s using an observer pattern. More sweetness.

For me, the best part about it is that it just works, out of the box, with a little config, exactly how I want it to. I can access and reference objects, libraries and resources how I would expect without any framework particular nuances ($CI =& get_instance(); anyone)? It makes just dropping into it easy.

I expect that the lessons I’ve learnt while using CI and the fact that it’s fairly similar in structure to CI has helped me get going with Kohana quicker, but it doesn’t feel quite as much like I’m running uphill when developing with the framework.

As an example, I recently wrote an ACL service with a RESTful API for some of our applications at work and I wanted to use Kohana to build a customer portal, I added a new driver for the Auth module and duplicated the ORM auth driver methods with my own ACL methods, using my API instead of ORM (or files, which is the other default option). Everything was written, presented a structured how I would expect a PHP5 application to be and so it took me only about three hours to implment the whole thing. Awesomesauce.

So, in summary, if you’re looking for a new framework, or an alternative to Codeigniter, you’d do much worse than check out Kohana. The Kohana team are busy writing V3 (http://v3.kohanaphp.com/) but it isn’t quite ready yet. This looks to be even more kick-ass.  More streamlined and uses the Zend style directory/filenaming structure. I’ll be checking this out when it’s released.

Advertisements

One thought on “Kohana: more than just a fork of Codeigniter

  1. Kohana seems to rock. The v3 release is too cool. I’m a Codeigniter guy but if all the CI guys take a deep look at kohana, i’m sure more than 50% will move to kohana. It’s just the forums and docs are not as rigorous as CI. I’m writing an AJAX app over Kohana. I love the debugging and error handling that kohana uses.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s