PHP code example of derywat / php-simple-storage

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

    

derywat / php-simple-storage example snippets


$ps = new SimpleLocalStorageJSONFile();
$ps->setStorageFileName('storage/json_persisted_file.txt');

$value = $ps->getValue('keyname');

$allValues = $ps->getValues();

$ps->setValue('keyname',$value);

$ps->unsetValue('keyname');


class NewSimpleStorageClass extends SimpleLocalStorage implements SimpleLocalStorageInterface {

	protected function _persist():void {
		//prepare $this->values for persistent storage
		//write or send data to storage or update changed data in storage
	}

	protected function _load():void {
		//load persisted data here
		$this->values = $loadedDataArray;
	}

}