Monday, June 08, 2009

I Love Kohana PHP Framework – My New Found Love

Kohana is not only my new found love when building applications with php, its also rock solid MVC (Model View Controller) Object Oriented Framework for php developers.
Just like the .NET Framework and Java SDK, Kohana can be referred to as some sort of SDK for php developers, it brings a lot of order into php codes which have been referred to as spaghetti codes for years .
With Kohana php or other php frameworks like Codeigniter, you can build your application with objects just like in Java and any other developer who knows how to use the framework will easily follow your code without asking you questions. if you ever wanted to use php in a team environment, I will ask you to consider Kohana due to the following reasons:

True Object Oriented:
Everything in Kohana SDK is an object, the helpers are objects with static methods, the libraries are all objects and you can create your own classes/objects, the views are objects (which is strange but programming wise very interesting), and of course the controllers and Models are all objects.
In other frameworks, I had never wanted to create controllers and extend them but in Kohana I realized that sometimes I have to build some ABSTRACT CONTROLLERS (I feel am back in Java), and then extends these controllers in the various sections of my website. For instance there is a Template Controller that helps developers using Kohana easily create master templates for their pages.

Best ORM in PHP:
ORM or object relational mapping is a technology where in you can map your database tables and their relationships in objects (Models) and then instantiate those models and call functions to get the data without writing SQL. In Kohana, I find ORM very easy to use and fun. Before ORM in Kohana, I tried ORM in Cakephp and Codeigniter but they all proved to be buggy or were too difficult to comprehend.

Templating made easy:
Templating is something most web developers in Africa will have to consider, it makes your life easy as a developer and makes the life of designers you work with super easy. In Kohana you create a single template.php file which can constitute the site's logo, navigation, sidebar and footer. Then fit in some variables that will change from control function to control function. This way my web apps all have one master template and just small view files that I set as variables. It makes my life easy to edit and also to change the design of the whole site in minutes. Check out the templating in Kohana at www.kohanaphp.com and you will be amazed

I8n aka internationalization:
Before Kohana I had to figure out how to hack Codeigniter to do internationalization but with Kohana, everything that appears on the screen as text you can use the i8n folder found in application/i8n and make sure you have text in every language possible. Coming from Cameroon, just like Canada we have french and english as official languages which means most of my apps have to be internationalized from day one.

PHPDOC and Code Hints, Code Completion:
In Kohana, since everything is an object, it simple means using phpdoc very well and a good IDE like Netbeans 6.5, you will get code hints and completion for both in build Kohana libraries, helpers, other classes and your own built classes. I use Netbeans 6.5 and when I code, I get a lot of speed reading the code hints and getting code completion for the functions in every helper or object I want to use. It makes my life easy and I just feel I am coding using .NET C# or Java. But other than Visual Studio, and like Eclipse, Netbeans is free and its light weight (in terms of memory consumption) and easy to install and configure to coding with php.

Those are some of the reasons I think I will go with Kohana.
Another question is:
why use php at all?
Well php is cheap for me and the server I have bought runs only php and most of my clients don't care which technology we use so we go with php. Hey with php I get to train and employ talents in the space of 6months, something I cant do with .NET or Java.

What do you think about Kohana php ?

14 comments:

Etum said...

Tu abandonnes Codeigniter? Kohana est encore trop jeune selon moi

Mambe Nanje said...

non je n'abandonnes pas codeigniter mais kohana est plus bon et cest plus rapide selon les nombres de codes que j'ecrire.
il ya les projets qu'ont utilise codeigniter chez nous mais si je suis presse mon frere cest kohana ;)

Anonymous said...

cul fresh blog, keep it up!
check out mine as well
http://blackspacemilan.blogspot.com/

pierre said...

Kohana rocks! I agree. I'm a coder from Canada living in Indonesia and what you say about Kohana is spot on.

Merci pour le beau blog and happy coding.

@Etum - A mon avis, Kohana est assez mature maintenant. J'ai hate de voir la versoin 3.

Mambe Nanje said...

Thanks Piere your comments are very much appreciated.
regards over there in Indonesia

chridam said...

Ii couldn't agree more with you Mambe, a good framework should be easy to learn, simple to use, intuitive to work with, easy to extend or to modify, rapid to build (maintain) applications with and of course stable. Kohana just wraps all these qualities with relative ease.

Mambe Nanje said...

thanks Chridam
I just found your comment now and it gives me more reasons to go on with kohana

HASH said...

I'm a big fan of Kohana too. That's the framework we use on Ushahidi.

If you're in to Kohana, you're over the biggest hurdle that new coders have on Ushahidi!

You can find the code at http://github.com/ushahidi

Mambe Nanje said...

hey HASH,
thanks for the comment. I was into codeigniter for like 2yrs then found kohana when it got to 2.2 and stable. so I have used it for like 10projects including villagediary.org . So how I can I help at Ushahidi ?

Unknown said...

It kind of depends how you'd like to do things. We can always use help with a little bug squashing, or you could be ambitious and take on challenges like the ones on this list:

http://wiki.ushahidi.com/doku.php?id=goma

We're actually about to hit a code freeze for the Goma release, but a couple of those items didn't make it. Like, we need to get translation and the plugin framework figured out.

If you want, you're more than welcome to join us on our dev Skype channel to chat.

Mambe Nanje said...

ok HASH,
we talk more about that via twitter
;)

drixie said...

Great to see another african coder going the mvc way. I'm on my first CI app though. I'll check out Kohana after. It shouldnt be hard to grasp then since it is a fork of CI

Kojilab said...

It is a great framework indeed. J'ai commence a l'utiliser apres des annees avec Symfony qui est trop bloated.

Tres facile d'ajouter des trucs et helpers. Y compris ce que Rails fait avec RJS. J'ai cree des helpers pour JQuery.

Mambe Nanje said...

bien sur Kojilab, I am happy you see with me that Kohona is more flexible but yet powerfull than Symphony...would you mine sharing some of the helpers you did for jquery, it could be of help to me
regards