Class Config_Group


extends Kohana_Config_Group
extends ArrayObject

Implements: IteratorAggregate | Traversable | ArrayAccess | Serializable | Countable

The group wrapper acts as an interface to all the config directives gathered from across the system.

This is the object returned from Kohana_Config::load

Any modifications to configuration items should be done through an instance of this object

Kohana Team
(c) Kohana Team


This class is a transparent base class for Kohana_Config_Group



integer 1


integer 2


protected string $_group_name

The group this config is for Used when updating config items

Default value:
string(0) ""

protected Kohana_Config $_parent_instance

Reference the config object that created this group Used when updating config

Default value:


public __construct(Kohana_Config <span class="param" title=""Owning" instance of Kohana_Config">$instance</span> , string $group [, array $config = array(0) ] ) (defined in Kohana_Config_Group)

Constructs the group object. Kohana_Config passes the config group and its config items to the object here.


  • Kohana_Config $instance required - "Owning" instance of Kohana_Config
  • string $group required - The group name
  • array $config = array(0) - Group's config

Source Code

public function __construct(Kohana_Config $instance, $group, array $config = [])
	$this->_parent_instance = $instance;
	$this->_group_name      = $group;

	parent::__construct($config, ArrayObject::ARRAY_AS_PROPS);

public __toString() (defined in Kohana_Config_Group)

Return the current group in serialized form.

echo $config;

Return Values

  • string

Source Code

public function __toString()
	return serialize($this->getArrayCopy());

public as_array() (defined in Kohana_Config_Group)

Alias for getArrayCopy()

Return Values

  • array - Array copy of the group's config

Source Code

public function as_array()
	return $this->getArrayCopy();

public get(string $key [, mixed $default = NULL ] ) (defined in Kohana_Config_Group)

Get a variable from the configuration or return the default value.

$value = $config->get($key);


  • string $key required - Array key
  • mixed $default = NULL - Default value

Return Values

  • mixed

Source Code

public function get($key, $default = NULL)
	return $this->offsetExists($key) ? $this->offsetGet($key) : $default;

public group_name() (defined in Kohana_Config_Group)

Returns the config group's name

Return Values

  • string - The group name

Source Code

public function group_name()
	return $this->_group_name;

public offsetSet(string $key , mixed $value ) (defined in Kohana_Config_Group)

Overrides ArrayObject::offsetSet() This method is called when config is changed via

$config->var = 'asd';

// OR

$config['var'] = 'asd';


  • string $key required - The key of the config item we're changing
  • mixed $value required - The new array value

Source Code

public function offsetSet($key, $value)
	$this->_parent_instance->_write_config($this->_group_name, $key, $value);

	return parent::offsetSet($key, $value);

public set(string $key , mixed $value ) (defined in Kohana_Config_Group)

Sets a value in the configuration array.

$config->set($key, $new_value);


  • string $key required - Array key
  • mixed $value required - Array value

Return Values

  • $this

Source Code

public function set($key, $value)
	$this->offsetSet($key, $value);

	return $this;

public append() (defined in ArrayObject)

public asort() (defined in ArrayObject)

public count() (defined in ArrayObject)

public exchangeArray() (defined in ArrayObject)

public getArrayCopy() (defined in ArrayObject)

public getFlags() (defined in ArrayObject)

public getIterator() (defined in ArrayObject)

public getIteratorClass() (defined in ArrayObject)

public ksort() (defined in ArrayObject)

public natcasesort() (defined in ArrayObject)

public natsort() (defined in ArrayObject)

public offsetExists() (defined in ArrayObject)

public offsetGet() (defined in ArrayObject)

public offsetUnset() (defined in ArrayObject)

public serialize() (defined in ArrayObject)

public setFlags() (defined in ArrayObject)

public setIteratorClass() (defined in ArrayObject)

public uasort() (defined in ArrayObject)

public uksort() (defined in ArrayObject)

public unserialize() (defined in ArrayObject)

Do you want to contribute to Koseven?

We need YOUR help!

This project is open source. What does this mean? YOU can help:
  • Found a bug? Report it on Github
  • Need a feature? Add it Here
  • Want to help? Join the Forum
Go to Github