1. Go to this page and download the library: Download ronolo/json-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/ */
ronolo / json-store example snippets
// First create the config object
$config = new Store\Config();
// Set the the adapter
$config->setAdapter(new Local('some/path/persons'));
// Secondly create the JsonDB
$store = new Store($config);
$document = file_get_contents('file/with/json/object.json');
// store a document
$id = $store->put($document);
// read a document
$document = $store->read($id);
// update document
$document->foobar = "Heinz";
$store->put($document);
// remove document
$store->remove($id);
$query = new Store\Query($store);
$result = $query->find([
"name" => "Bernd"
]);
// An iterator can be used to fetch one by one all documents
foreach ($result as $id => $document) {
; // do something with the document
}