Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: 13 days 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 (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2019-08-10T03:36:57.000Z (about 5 years ago)
- Last Synced: 2024-10-05T04:41:53.193Z (about 1 month ago)
- Topics: database, json, json-orm, static-file-orm
- Language: PHP
- Homepage:
- Size: 19.5 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# JSON PDO
[![Build Status](https://travis-ci.org/alesanchezr/json-orm.svg?branch=master)](https://travis-ci.org/alesanchezr/json-orm)
[![Coverage Status](https://coveralls.io/repos/github/alesanchezr/json-orm/badge.svg?branch=master)](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