In this article we will discuss some important features of Kohana, a promising and the sexiest community driven php framework. This article is pretty basic and intended to instigate those who are still not familiar with this framework. One of the problem with this framework is the lack of well organized documentation. Anyway there are many useful resources available and I have mentioned some of them at the end of this article.To start with, Koahana is a flexible and swift PHP5 framework that follows HMVC (hierarchical Model view controller ) design pattern. Its current stable version is 3.0.9. It started as a fork of well known PHP 4/5 framework codeigniter. 2.X is the remarkable initial version. Version 3.x is a complete rewrite of V 2.x with robust functionalities and significant improvements (also changed the design pattern from mvc to hmvc). Lets go with the awesome features of kohana.
File system
The most important feature of this framework is its cascading hmvc filesystem, which makes this framework flexible and extensible. It is a hierarchy of similar mvc directory structures that cascade. This hierarchy enables us to override anything (properties, methods and even files) in a higher level. Each collection of directory structure will be independent of others. It will be useful to understand the filesystem before going to the real stuffs.
Scalability
Its hmvc file system promises the seamless scalability of our applications. If you are weaving your dream project you might be considering scalability as an important design concern. You will be splitting up your project into modules with least dependency. So it will be easier to go with kohana. If you are not considering scalability as an important design concern, again it will be easier to go with kohana..!! Since it is a simple and easier framework. Latest trends in web, especially in cloud, indicates the necessity of making our application scalable. We can find many popular applications that suffers bottlenecks while serving large requests due to scalability issues. If our application is scalable we will be able to move any module to a different location. We can make direct requests to any module. If we ever need to use the same thing in two places, we can achieve it without duplicating the code, either by making internal requests to that section or by keeping that in module folder.Kohana take advantage of hmvc using its unique request execution mechanism. We can make explicit requests from inside our application. It can be a request to any internal components or to an external application (Just think of a part of main application running in a different server). Requests can be invoked from a view also. Lets see a simple example.Check this link To know more about kohana request flow.Please check this link to read more about scaling application using kohana. Of course this scalability comes with a performance cost. But we can significantly improve the performance through caching and parallel processing.
Easy Configuration
Kohana provides easy configuration options. Like anything, we can also override configurations from a higher level. Config files are placed in config directory and it will return an array of key value pairs. Configurations can be retrieved using Kohana::config() mehod. For example Kohana::config(‘test’) will return configuration for the above module.
Routing
Kohana has an excellent routing mechanism with which we can manage different kinds of urls. For a uri, the routing mechanism will search for the first matching rout and the remaining will be ignored. Routes can be defined either in application/bootstrap.php or moduledir/init.php using the Rout::set() method. For more about routing, go through this kohana guide.
Security
To help secure your applications, tools for XSS removal, input validation, signed cookies, form and HTMLgenerators are all included. The database layer provides protection against SQL injection. Of course, all official code is carefully written and reviewed for security. (From kohana documentation)
Inbuilt modules
Kohana comes bundled with a set of pretty good modules. Database abstraction module, ORM, pagination etc are a few of them. Also,we can find a number of modules on Kohana-Modules
Exception handling and Profiling
Kohana is bundled with excellent exception handling which will enable debugging easier. Inbuilt support for profiling the code will enable us to write code efficiently.This is not all about this great framework. You can find many excellent articles and tutorials on the web. Here I have aggregated some of them.
Summery
Kohana is an excellent framework because of many nice features incorporated in it. It is more scalable, flexible and light wight than many other well known frameworks. It can needs lesser/no configuration. It gives good security from various attacks like XSS, SQL injection, session hijacking etc.
Resources and Tutorials
Kohana official documentation
Unofficial kohana wiki
Kohana tutorials
Query 7 Blog : An Introduction To Kohana3 PHP Framework
Stack Overflow
kohanaframework.blogspot.com : A dedicated kohana tutorial blog
Please add any useful links or resources that you found interesting as comment.