mthenw/nosqlite 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

mthenw/nosqlite

Composer 安装命令:

composer require mthenw/nosqlite

包简介

Simple key => value store based on SQLite3

README 文档

README

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

统计信息

  • 总下载量: 2.21k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 50
  • 点击次数: 0
  • 依赖项目数: 3
  • 推荐数: 0

GitHub 信息

  • Stars: 49
  • Watchers: 4
  • Forks: 8
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2012-02-09