PHP code example of kumatch / keystore

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

    

kumatch / keystore example snippets


use Kumatch\KeyStore\Storage;
use Kumatch\KeyStore\Filesystem\Driver;  // driver

$driver = new Driver("/tmp");
$storage = new Storage($driver);

$key = "foo/bar";
$value = "Hello, world.";

$storage->write($key, $value);

$key = "foo/bar";
$value = "Hello, world.";

$storage->append($key, $value);

$key = "foo/bar";
$value = $storage->read($key);
// returns a value of a key
// if key is not exists, returns null

$key = "foo/bar";
$isExists = $storage->exists($key);
// returns boolean

$key = "foo/bar";
$storage->remove($key);

$key = "foo/bar";
$filename = "/path/to/input.jpg";

$storage->import($key, $filename);

$key = "foo/bar";
$filename = "/path/to/output.jpg";

$storage->export($key, $filename);
// outputs a value to file path.

$src = "foo/bar";
$dst = "path/to/destination";

$storage->copy($src, $dst);