PHP code example of kolirt / laravel-settings

1. Go to this page and download the library: Download kolirt/laravel-settings 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/ */

    

kolirt / laravel-settings example snippets


use Kolirt\Settings\Facades\Setting;

Setting::set('string', 'value');

Setting::set('array', [0, 1, 2]);
Setting::set('array.0', 'new value with index 0');

use Kolirt\Settings\Facades\Setting;

Setting::all();
/**
 * Returns
 * 
 * [
 *   'string' => 'value',
 *   'array' => ['new value with index 0', 1, 2]
 * ]
 */

use Kolirt\Settings\Facades\Setting;

Setting::get('string'); // 'value'

Setting::get('array'); // ['new value with index 0', 1, 2]
Setting::get('array.0'); // 'new value with index 0'

// or via helper

setting('string'); // 'value'

setting('array'); // ['new value with index 0', 1, 2]
setting('array.0'); // 'new value with index 0'

use Kolirt\Settings\Facades\Setting;

Setting::delete('string');

Setting::delete('array'); // delete all array values
Setting::delete('array.0'); // delete array value with index 0

use Kolirt\Settings\Facades\Setting;

Setting::flushCache();
bash
php artisan settings:install

php artisan migrate