PHP code example of originphp / value-store

1. Go to this page and download the library: Download originphp/value-store 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/ */

    

originphp / value-store example snippets


use Origin\ValueStore\ValueStore;

$settings = new ValueStore(storage_path('settings.json'));

$settings->email = '[email protected]'
$settings->incomingServer = [
    'host' => 'mail.example.com',
    'port' => 993,
    'encryption' => 'ssl'
];
$settings->active = true;

$settings->save();

unset($settings->key);
$hasKey = isset($settings->key);
$keys = count($settings);

foreach($settings as $key => $value){
    ...
}

$settings->increment('count');
$settings->decrement('count');

$settings->increment('count', 4);
$settings->decrement('count', 3);

$settings->set('foo','bar');
$settings->set(['foo'=>'bar','key'=>'value']); // Set multiple values.

$foo = $settings->get('foo');

$keyExists = $settings->has('foo');
$setting->unset('foo');
$count = $settings->count();

$value = $settings['foo'];
$settings['foo'] = 'bar'
unset($settings['foo']);
$has = isset($settings['foo']);

$settings->clear(); // clears all values

$settings->toArray();
$settings->toJson();
$settings->toPhp();
$settings->toXml(); //