https://github.com/alesanchezr/json-orm
Create and manage a database with just JSON static files.
https://github.com/alesanchezr/json-orm
database json json-orm static-file-orm
Last synced: 6 months ago
JSON representation
Create and manage a database with just JSON static files.
- Host: GitHub
- URL: https://github.com/alesanchezr/json-orm
- Owner: alesanchezr
- Created: 2018-11-07T04:55:45.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-08-10T03:36:57.000Z (over 6 years ago)
- Last Synced: 2025-05-02T04:17:43.011Z (10 months ago)
- Topics: database, json, json-orm, static-file-orm
- Language: PHP
- Homepage:
- Size: 19.5 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# JSON PDO
[](https://travis-ci.org/alesanchezr/json-orm)
[](https://coveralls.io/github/alesanchezr/json-orm?branch=master)
Very simple JSON file based database manager.
## Installation
This library can be found on [Packagist](https://packagist.org/packages/alesanchezr/json-orm).
The recommended way to install is through [composer](http://getcomposer.org).
Edit your `composer.json` and add :
```json
{
"require": {
"alesanchezr/json-orm": "dev-master"
}
}
```
Install dependencies :
```bash
php composer.phar install
```
## How use it?
```php
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 :
```console
./vendor/bin/phpunit --bootstrap vendor/autoload.php tests/*
```
## License MIT
## Contact
Authors : Alejandro Sanchez