-
Notifications
You must be signed in to change notification settings - Fork 0
Registry
A simple PHP storage registry.
[strong]Download:[/strong] [url=https://github.com/alwarren/php.registry/zipball/master]https://github.com/alwarren/php.registry/zipball/master[/url]
[h2]Usage[/h2] [code] require_once 'registry.php'; [/code] [h3]As an Object[/h3] [code] // store a value $value = 'Hello World!' // mixed, can be anything $reg = new registry(); $reg->set('mykey', $value);
// retrieve a value
$myvar = $reg->get('mykey');
[/code] [h3]As an Singleton[/h3] [code] // store a value $value = 'Hello World!' // mixed, can be anything registry::getInstance()->set('mykey', $value);
// retrieve a value
$myvar = registry::getInstance()->get('mykey');
[/code] [h3]Method Chaining[/h3] [code] // store a value $value1 = 'Hello World!' $value2 = "It's a great day." registry::getInstance() ->set('mykey1', $value1) ->set('mykey2', $value2) ; [/code] [h3]Query[/h3] [code] if registry::contains('mykey') { // do something } [/code]