1. Go to this page and download the library: Download myaaghubi/mhm-json-db 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/ */
myaaghubi / mhm-json-db example snippets
$db = new MHMJsonDB('mydb.json', $pathToDB);
// select all: array of arrays or an empty array
var_dump($db->select());
// select multiple: array of arrays or an empty array
// sort: $db->select(['name' => 'Moham'], 'name', true);
var_dump($db->select(['name' => 'Moham']));
// select one item/array or null
$result = $db->selectOne(['name' => 'Moham']);
// returns the whole record as an array
$insertedRecord = $db->insert(['name' => 'Moham', 'email' => '...']);
// returns true or false
$insertedRecord = $db->update(['name' => 'Moham', ...], ['name' => 'Mohammad', ...]);
// delete multiple: returns the number of deleted
$deleted = $db->delete(['id' => $insertedRecord['id']]);
// delete all
$deleted = $db->delete();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.