This is documentation for Kohana v2.3.x. For v3.x documentation, see http://kohanaframework.org/guide .
|Todo||Expand, Proof read|
Kohana is easily extendable using modules. Modules are reusable collections of related files that together add a particular functionality to an application. You may want to re-use some helpers or add authentication across multiple applications. Place it in a module folder and you can copy it with ease or have multiple applications use the same module directory.
It is most common to have a directory called
modules in the same directory as the
system directories. For instance, we created a module for ACL (access control lists) and authentication (auth) since we want to reuse it across applications.
root +- application +- system +- modules | +- acl | | +- helpers | | +- i18n | | +- libraries | | +- models | | +- vendor | | +- views | | | +- auth | +- helpers | +- i18n | +- libraries | +- models | +- vendor | +- views | +- index.php
Only placing modules in the
modules directory won't load them, they must be configured for Kohana to use them. This can be done in the
application/config/config.php file using the 'modules' setting.
// Paths are relative to the docroot, but absolute paths are also possible // Use the MODPATH constant (?) $config['modules'] = array ( MODPATH.'acl', MODPATH.'auth', )
In the cascading filesystem, files in modules that are higher up the list take precedence over those lower down just as files in the
application directory do over those in modules and the