Skip to content

Create and manage a database with just JSON static files.

Notifications You must be signed in to change notification settings

alesanchezr/json-orm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JSON PDO

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

About

Create and manage a database with just JSON static files.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages