PHP code example of weboap / option

1. Go to this page and download the library: Download weboap/option library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

weboap / option example snippets


php composer 
 php
'Weboap\Option\OptionServiceProvider'
 php
php artisan vendor:publish
php artisan migrate
 php


//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']);