forked from bcit-ci/CodeIgniter
-
Notifications
You must be signed in to change notification settings - Fork 0
Registry
Derek Jones edited this page Jul 5, 2012
·
9 revisions
A simple PHP storage registry.
This class was originally written independent of CodeIgniter but also works nicely as an autoloaded class.
Download: https://github.com/alwarren/php.registry/zipball/master
Loading the class:
// modify application/config/autoload.php
$autoload['libraries'] = array('registry');
Using the class:
// store a value
$value = 'Hello World!' // mixed, can be anything
$this->registry->set('mykey', $value);
// retrieve a value
$myvar = $this->registry->get('mykey');
// query the registry
if ($this->registry->contains('mykey'))
{
// do something
}
// method chaining
$value1 = 'Hello World!'
$value2 = "It's a great day."
$this->registry
->set('mykey1', $value1)
->set('mykey2', $value2)
;