Git Product home page Git Product logo

nosqlite.php's Introduction

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

nosqlite.php's People

Contributors

jasir avatar mthenw avatar petrozavodsky avatar smasty avatar valeriangalliat avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.