NoSQLite – simple key => value store
Find a file
2019-04-26 20:24:11 +02:00
src/NoSQLite Merged new changed. 2013-09-26 21:03:46 +02:00
test/NoSQLite/Tests Removed redundant method 2013-09-26 21:14:41 +02:00
.gitignore Code coverage by Coveralls 2013-10-28 18:42:26 +01:00
.travis.yml Code coverage by Coveralls 2013-10-28 18:42:26 +01:00
composer.json Update composer.json 2015-01-21 22:41:42 +01:00
LICENSE License in separate file 2013-11-24 12:28:16 +01:00
makefile Code coverage by Coveralls 2013-10-28 18:42:26 +01:00
phpunit.xml.dist Running test using phpunit from composer 2013-05-30 12:35:02 +02:00
README.md Fix example 2019-04-24 11:20:21 +03:00

NoSQLite simple key => value store based on SQLite3

Build Status Coverage Status Latest Stable Version

Introduction

NoSQLite is simple key-value store using SQLite as raw data store. Mainly for small project where MySQL is too heavy and files are too ugly.

Requirements

  • PHP >=5.3.2
    • PDO (by default as of PHP 5.1.0)
    • PDO_SQLITE (by default as of PHP 5.1.0)

Installing via Composer

Get composer and add following lines to composer.json:

{
    "require": {
        "mthenw/nosqlite": "*@stable"
    }
}

Usage

  1. Create stores' manager (file will be created if not exists)

     $nsql = new NoSQLite\NoSQLite('mydb.sqlite');
    
  2. Get store

     $store = $nsql->getStore('movies');
    
  3. Set value in store (key and value max length are limited by SQLite TEXT datatype)

     $store->set(uniqid(), json_encode(array('title' => 'Good Will Hunting', 'director' => 'Gus Van Sant')));
    
  4. Get value from store (will be created if not exists)

     $store->get('3452345');
    
  5. Get all values

    $store->getAll();
    
  6. Delete all values

     $store->deleteAll();
    
  7. Iterate through store (Store implements Iterator interface)

     foreach($store as $key => $value)
         ...
    
  8. Get number of values in store (Store implements Countable interface)

     count($store);
    

Tests

Tests are written in PHPUnit which is required as a dev package in composer.json. For running test use

./vendor/bin/phpunit

or simply

make test