PHP code example of softinklab / laravel-keyvalue-storage

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

    

softinklab / laravel-keyvalue-storage example snippets


SoftinkLab\LaravelKeyvalueStorage\KeyValueStorageServiceProvider::class,

'KVOption' => SoftinkLab\LaravelKeyvalueStorage\Facades\KVOption::class,

use SoftinkLab\LaravelKeyvalueStorage\Facades\KVOption;

// Check is the option exists. Return true if found.
KVOption::exists('key');

// Get the option value.
KVOption::get('key');

// Get the option value. Default value is optional. If option not found default value is returned.
KVOption::get('key', 'default value');

// Add new option. Comment is optional. Comment is only working in Database Mode.
KVOption::set('key', 'value', 'comment');

// Add multiple options.
// Example Input => [['key1', 'value1', 'comment1'],['key2', 'value2', 'comment2']]
KVOption::setArray('array');

// Increment the value of a given key and return it as integer. Factor is used to determine the step. Default is one.
KVOption::increment('key', 'factor');

// Decrement the value of a given key and return it as integer. Factor is used to determine the step. Default is one.
KVOption::decrement('key', 'factor');

// Delete an option
KVOption::remove('key');

// Check is the option exists. Return true if found.
kvoption_exists('someKey');

// Get the option value.
kvoption('key');

// Get the option value. Default value is optional. If option not found default value is returned.
kvoption('key', 'default value');

// Add new option. Comment is optional. Comment is only working in Database Mode.
kvoption(['key','value', 'comment']);

// Add multiple options.
// Example Input => [['key1', 'value1', 'comment1'],['key2', 'value2', 'comment2']]
kvoption('array');

{{kvoption('key')}}
ssh
php artisan vendor:publish --provider="SoftinkLab\LaravelKeyvalueStorage\KeyValueStorageServiceProvider"
ssh
php artisan migrate
bash
php artisan kvoption:create {key} {value} --comment={comment}
bash
php artisan kvoption:delete {key}