PHP code example of jsondbphp / jsondb

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

    

jsondbphp / jsondb example snippets


<?

e App\JSONDatabase;

$path = 'data/users.json';

$db = new JSONDatabase($path);

$data = [
   'id' => 1,
   'name' => 'Sushil',
   'age' => 23,
   'dev' => true,
   'lang' => ['php','javascript','sql']
];

// post data
$db->write($data);

// fetch data
$result = $db->read();

echo "<pre>";
print_r($result);
echo "</pre>";