Kohana 2.3 Look Ahead!

Published on:
Tags: Kohana, PHP

Routing I’ve recently had the chance to have a little play with with the Kohana trunk (what will be Kohana 2.3) so I thought I would use this post to highlight some of the cool new features we can expect in the next release! The list is by no means exhaustive but will hopefully serve to lessen the learning curve when release day comes (or if you decide to have a play with the trunk). There has been some mixed reception to some of the changes, so if you’ve missed any of these then hopefully the below will get you back up to speed!

Folder Structure The first thing you will probably notice is the fairly major reorganisation of the folder layout: When looking in the top level of the application or system directories you will notice the controllers, helpers, libraries and models folders have all been removed in favor of a single classes folder. Within this classes folder can be found a controller and model folder (in which your controllers and models are placed respectively), the semantic difference between helpers and libraries has been lessened and as such both are now placed in the top level of the classes directory. I was always slightly unsure of the forced separation there, and so the combination of the two is a positive stop in my opinion.

With the change comes future proofing against PHP 5.3, deceased complexity and transparent extension of classes (more later).

There has been some uneasiness within the community about this change, so I encourage you to grab a copy of the trunk and take a look for yourself, I’m pretty confident though that most will come to see the benefits of this.

Routing Another well talked about change is that of the new routing implementation. Going hand in hand with the directory structure the new routing implementation brings Kohanas own implementation of the Horde routing. After a bit of playing with this and overcoming a couple of WTF!® moments, I have slowly began to really like this, especially the reverse routing concept which I looked into a while ago, I’m definitely going to play with this more, and I’m not sure if there are any plans to implement any of the other Horde features, but it definitely allows for a great deal of flexibility I’m going to dedicate an article to this in the near future so I will purposely cut this a little short.

Class Extensions Extensions are now placed in a directory called . .. extensions, which resides in the top level (along with classes, views etc etc). Any classes (who’s names are appended _Core) can now be extended..

  class ORM_Custom extends ORM
 {
 .....

The above code will extend ORM transparently allowing for the full power of extensions to be realised with even greater ease than previously, it also provides a nice logical organizational separation of all your extensions enabling you to easily keep track of extensions in your project

Kohana Modules Not so much coming in 2.3 as it has arrived already, but 2.3 will see the removal of some Kohana modules from the core support and their adding to the Kohana Modules project. Of note at the moment however is the object database which will come to replace the current database library (as far as I’m aware anyway, please correct me if I’m wrong!) – so keep an eye on that one

So that covers the main points as I see them right now, hopefully I’ll throw together an article that looks at the routing in a bit more detail soon, so check back for that!

/Matt