This is documentation for Kohana v2.3.x. For v3.x documentation, see .

Table of Contents
TodoExpand, 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.

The Filesystem page should be read before this one to understand it properly.

Setting up

It is most common to have a directory called modules in the same directory as the application and system directories. For instance, we created a module for ACL (access control lists) and authentication (auth) since we want to reuse it across applications.

 +- 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

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 system directory.

general/modules.txt · Last modified: 2010/01/18 16:35 by wpjmurray