PHP code example of alesanchezr / json-orm
1. Go to this page and download the library: Download alesanchezr/json-orm library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
alesanchezr / json-orm example snippets
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');
bash
php composer.phar install
console
./vendor/bin/phpunit --bootstrap vendor/autoload.php tests/*