PHP code example of vinlon / laravel-options
1. Go to this page and download the library: Download vinlon/laravel-options 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/ */
vinlon / laravel-options example snippets
opt()->set('key', 'value');
opt()->set('key', 'value_new');
$value = opt()->get('key'); // "value_new"
opt()->del('key');
$value = opt()->get('key', 'default_value'); // "default_value"
opt()->batchSet(['key1' => 'value1', 'key2' => 'value2']);
opt()->batchSet(['key1' => 'value1_new', 'key2' => 'value2']);
$values = opt()->batchGet(['key1', 'key2']); // ["key1":"value1_new", "key2":"value2"]
opt()->batchDel(['key1', 'key2']);
$values = opt()->batchGet(['key1', 'key2']); // []
opt('test_')->set('key', 'test_value');
$value = opt()->get('test_key');
$value = opt('test_')->get('key'); // "test_value"
$value = opt()->withPrefix('test_')->get('key'); // "test_value"
opt('test_')->del('key');
$value = opt('test_')->get('key'); // null
opt('test_')->batchSet(['key' => 'test_value_new']);
$values = opt('test_')->batchGet(['key']); // ["key":"test_value_new"]
$values = opt('test_')->batchGet(['key'], false); // ["test_key":"test_value_new"]
opt('test_')->batchDel(['key']);
$values = opt('test_')->batchGet(['key']); // []
shell
php artisan migrate