Very simple JSON file based database manager.
This library can be found on Packagist.
The recommended way to install is through composer.
Edit your composer.json
and add :
{
"require": {
"alesanchezr/json-orm": "dev-master"
}
}
Install dependencies :
php composer.phar install
require 'vendor/autoload.php';
use JsonPDO\JsonPDO;
//create a database pointing to a file or folder
$orm = new JsonPDO('./tests/data/');
//get any file from the data folder
$content = $orm->getJsonByName('countries');
//save some data into a json file
$someData = [ "ve" => "venezuela" ];
$file = $orm->toNewFile('countries');
$file->save($content);
//check if a json file exists
$exists = $orm->jsonExists('countries');
//if there are several json files, you can list them all
$allFiles = $orm->getAllFiles();
//delete a json file
$orm->deleteFile('countries');
Launch from command line :
./vendor/bin/phpunit --bootstrap vendor/autoload.php tests/*
Authors : Alejandro Sanchez