weboap / option
This package is abandoned and no longer maintained.
No replacement package was suggested.
Save and retreive config from db for laravel 5 / Access Config as Array
v2.0.4
2019-02-10 07:33 UTC
Requires
- php: >=5.4.0
Requires (Dev)
- illuminate/cache: 5.*
- illuminate/config: 5.*
- illuminate/support: 5.*
- mockery/mockery: dev-master
README
Save and retreive config from db for laravel / Access Config as Array
Laravel 4 users use "weboap/option": "v1.0.5"
Installation
The recommended way to install Winput is through composer.
Step 1
php composer require weboap/option
Step 2 (optional)
Add config/app.php if you are using laravel <5.5
'Weboap\Option\OptionServiceProvider'
Step 3
Migrate the Option Table Run
php artisan vendor:publish php artisan migrate
you can check app/option.php to costumize Option config file.
Usage
Note : the keys are to be set group.key (eg: 'gallery.path', 'cache.timeout') that way the options are grouped per categories keys that don't have a group the package will prepend 'global.' to eg: seting a key : 'business' will be retreived like 'global.business'
//set one key Option::set('group.key', 'value'); // or set an array of key, values Option::set(['key0'=> 'value', 'group.key'=>'value', 'someothergroup.key1'=>'value1', .....]); Option::get('group.key'); Option::get('global.key'); Option::group('prefix'); // will return an array of options prefixed with group Option::forget('group.key'); Option::has('group.key'); //retreive all keys, values at once Option::all(); or you can access config as array like $config = App::make('option'); $config['mygroup.foo'] = 'bar'; echo $config['mygroup.foo']; unset($config['mygroup.foo']);
Enjoy!