alesanchezr/json-orm

There is no license information available for the latest version (0.0.3) of this package.

PHP Engine for a simple JSON file based database.

0.0.3 2019-04-09 20:45 UTC

This package is auto-updated.

Last update: 2024-04-10 13:19:45 UTC


README

Build Status Coverage Status

Very simple JSON file based database manager.

Installation

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

How use it?

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');

Running Tests

Launch from command line :

./vendor/bin/phpunit --bootstrap vendor/autoload.php tests/*

License MIT

Contact

Authors : Alejandro Sanchez