PHP JSON DB: Store and retrieve key-value pairs from JSON files

Recommend this page to a friend!
  Info   View files Documentation   View files View files (3)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 515 All time: 5,678 This week: 436Up
Version License PHP version Categories
json-db 1.0MIT/X Consortium ...5.2.17PHP 5, Databases, Files and Folders, C...
Description Author

This class can store and retrieve key-value pairs from JSON files.

It extends the Horus framework container class to store and retrieve values from files in the JSON format,

The values can optionally be encrypted and decrypted using a given key.

Picture of Mohammed Al Ashaal
  Performance   Level  
Name: Mohammed Al Ashaal <contact>
Classes: 8 packages by
Country: Egypt Egypt
Age: 27
All time rank: 130310 in Egypt Egypt
Week rank: 773 Up12 in Egypt Egypt Down
Innovation award
Innovation award
Nominee: 2x

Winner: 1x


<h1>Horus JsonDB ?</h1> <blockquote> A secure json based flatfile key value store that helps you in quick and light developments . </blockquote>

<h1>When to use it ?</h1> <blockquote> <ul>

<li>Building a persistent registry system</li>
<li>Building a persistent caching system</li>
<li>Simple key value store</li>
<li>Store you application settings</li>
<li>Simple webblogs</li>

</ul> </blockquote>

<h1>Requirements ?</h1> <ul>

<li>Horus 9, from <a href="" target="_blank">here</a></li>


<h1>Usage ?</h1>


    // load horus 9 and jsonDB
    require( "H9.php" );
    require( "JsonDB.php" );

    $app = new Horus;

    // initialize jsonDB from a local file
    // it will be created if not exists
    // the directory must be writable .

    $app->jsdb = new JsonDB('basic.file');

    // or tell it to encrypt the file on end
    // $app->jsdb = new JsonDB('secure.file', 'secret-key-to-be-used');

    // it extends Horus_Container Object
    // so it is very easy, just commit after ending .

    // set a key
    $app->jsdb->set('k1', 'v1');
    $app->jsdb->k2 = 'v2';
        'k3'    =>  'v3',
        'k4'    =>  'v4'

    // set a key to false

    // check if it were disabled

    // set a key to true

    // check if it were enabled

    // get a key
    $k1 = $app->jsdb->get('k1');
    $k3 = $app->jsdb->k3;

    // export all as array
    $all = $app->jsdb->export();

    // export as iterator
    $iterator = $app->jsdb->getIterator();

    // delete

    // save changes "write all to the disk" ?

  Files folder image Files  
File Role Description
Plain text file JsonDB.php Class Class source
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file Doc. Documentation

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:5,678
This week:436Up

For more information send a message to info at phpclasses dot org.