Laravel 4 Registry Manager for storing application specific settings

Laravel 4 Registry Manager for storing application specific settings

README

Laravel 4/5 Registry Manager for storing application specific settings. A mashup of https://github.com/theelphie/registry and https://github.com/torann/laravel-4-registry. A big thanks to @Torann and @theelphie.

Thanks also to @srlabs for his blog on Laravel 5 Package Development

Installation for Laravel 5

Add the following into your composer.json file:

{
	"require": {
		"twosuperior/registry": "2.0.x"
	}
}

Installation for Laravel 4

Add the following into your composer.json file:

{
	"require": {
		"twosuperior/registry": "1.0.x"
	}
}

Post Install Setup for Laravel 5

Add the service provider and alias into your app/config/app.php

'providers' => [
	TwosuperiorRegistryRegistryServiceProvider::class,
],

'Registry' => TwosuperiorRegistryFacadesRegistry::class,

Run php artisan vendor:publish

Post Install Setup for Laravel 4

Add the service provider and alias into your app/config/app.php

'providers' => array(
	'TwosuperiorRegistryRegistryServiceProvider',
),

'Registry' => 'TwosuperiorRegistryFacadesRegistry',

Run php artisan config:publish "twosuperiorregistry"

Run php artisan migrate --package="twosuperiorregistry" to install the registry table

Usage

Retrieve item from registry

Registry::get('foo'); \will return null if key does not exists
Registry::get('foo.bar'); \will return null if key does not exists

Registry::get('foo', 'undefine') \will return undefine if key does not exists

Store item into registry

Registry::set('foo', 'bar');
Registry::set('foo', array('bar' => 'foobar'));

Registry::get('foo'); \bar
Registry::get('foo.bar'); \foobar

Remove item from registry

Registry::forget('foo');
Registry::forget('foo.bar');

Clear cache and reload registry

Registry::clear();

Flush registry table

Registry::flush();

Dump all values from an item

Registry::dump('foo');

Retrieve all items from registry

Registry::all();

Mass update

$settings = Input::only('name', 'address', 'email');

Registry::store($settings);

Source

Add a Comment

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *

Laravel 4 Registry Manager for storing application specific settings

Laravel 4 Registry Manager for storing application specific settings

README

Laravel 4/5 Registry Manager for storing application specific settings. A mashup of https://github.com/theelphie/registry and https://github.com/torann/laravel-4-registry. A big thanks to @Torann and @theelphie.

Thanks also to @srlabs for his blog on Laravel 5 Package Development

Installation for Laravel 5

Add the following into your composer.json file:

{
	"require": {
		"twosuperior/registry": "2.0.x"
	}
}

Installation for Laravel 4

Add the following into your composer.json file:

{
	"require": {
		"twosuperior/registry": "1.0.x"
	}
}

Post Install Setup for Laravel 5

Add the service provider and alias into your app/config/app.php

'providers' => [
	TwosuperiorRegistryRegistryServiceProvider::class,
],

'Registry' => TwosuperiorRegistryFacadesRegistry::class,

Run php artisan vendor:publish

Post Install Setup for Laravel 4

Add the service provider and alias into your app/config/app.php

'providers' => array(
	'TwosuperiorRegistryRegistryServiceProvider',
),

'Registry' => 'TwosuperiorRegistryFacadesRegistry',

Run php artisan config:publish "twosuperiorregistry"

Run php artisan migrate --package="twosuperiorregistry" to install the registry table

Usage

Retrieve item from registry

Registry::get('foo'); \will return null if key does not exists
Registry::get('foo.bar'); \will return null if key does not exists

Registry::get('foo', 'undefine') \will return undefine if key does not exists

Store item into registry

Registry::set('foo', 'bar');
Registry::set('foo', array('bar' => 'foobar'));

Registry::get('foo'); \bar
Registry::get('foo.bar'); \foobar

Remove item from registry

Registry::forget('foo');
Registry::forget('foo.bar');

Clear cache and reload registry

Registry::clear();

Flush registry table

Registry::flush();

Dump all values from an item

Registry::dump('foo');

Retrieve all items from registry

Registry::all();

Mass update

$settings = Input::only('name', 'address', 'email');

Registry::store($settings);

Source

Add a Comment

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *