Registry a database based Registry library for Laravel.
Inspired by Richard Davey's Codeiginiter spark: http://www.richarddavey.com https://github.com/richarddavey/codeigniter-registry
Create a database table to store registry values
CREATE TABLE IF NOT EXISTS `registry` (
`key` varchar(255) NOT NULL,
`value` varchar(255) NOT NULL,
PRIMARY KEY (`key`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
Install via artisan:
php artisan bundle:install registry
or download the zip from github and unzip into your 'bundles' directory
https://github.com/cinkmedia/laravel-registry
Add the following to your application/bundles.php file:
'registry',
So your bundle configuration includes the 'registry' bundle ('docs' is not required by Registry and is there in a default Laravel install):
return array(
'docs' => array('handles' => 'docs'),
'registry',
);
## Guide
Get a registry value:
Registry::getValue('my_key_to_fetch');
Set a registry value temporarily - this value will only be stored for the lifetime of the instance:
Registry::setValue('my_key_to_set','my_value_to_set');
Set a registry value permanently - this value will permanently stored in the database:
Registry::setValue('my_key_to_set','my_value_to_set', true);
Reset a registry value to the one stored in the database:
Registry::resetValue('my_key_to_reset');
Delete a registry value:
Registry::deleteValue('my_key_to_delete');
Save all overriden values to the database
Registry::save();
You can define the name of the table used to store registry values in config/registry.php. Full documentation is included in the config file.