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

Table of Contents
Todoelaborate on load(), include_paths()

Config Class


This class is deprecated in version 2.2 or later. This methods are now in Kohana class.

Provides methods for working with configuration items.

Where to put the configuration?

Configuration files must be placed in a folder named config, this folder can reside in system, application or a module. Application is more important than system and will override it. Modules override system files but are overridden by application files.

The config file must be in this format:

$config = array
	'language' => 'en_US',
	'timezone' => ''


Retrieving configuration items

Config::item($key, $slash = FALSE, $required = TRUE) retrieves a configuration item, can return a string, array or boolean. $slash will force a forward slash at the end of the item. $required determines whether an item is required or not.

Config::item('locale.language'); //returns the language from the **locale.php** file and returns the config['language'] item.

Setting a configuration item

For setting configuration items in realtime you must enable this setting in the config.php file. (core.allow_config_set)

Config::set($key, $value) sets a configuration item, returns TRUE on success or FALSE when it didn't succeed.



If you want to set a configuration in realtime make sure the config.allow_config_set is set to TRUE in application/config.php

Getting the include paths

Config::include_paths($process= FALSE) gets the include paths and returns an array. First in the array is the application path, last will be the system path, other items will be include paths set in the configuration item 'core.include_paths'. $process, if true, will reprocess the include_paths.


Load a configuration file

Config::load($name, $required = TRUE) loads a configuration file. Config::item() loads them as well if they're not already loaded and retrieves the items straightaway.

core/config.txt · Last modified: 2009/12/17 10:45 by marcelorodrigo