scottaubrey/pstore

A btree-based key-value embeddable database, designed to serialise and store objects

dev-default 2017-07-13 21:05 UTC

This package is auto-updated.

Last update: 2020-07-26 01:26:10 UTC


README

This is a simple, file-backed object store for PHP I wrote for prototyping Domain objects. It contains a high-level API inspired by MongoDB's simple API, and a low-level append-only binary tree, whose design and API was inspired by the Append-only B+Tree project published by Jakub Kulhan at https://github.com/jakubkulhan/btree

IT IS NOT FOR PRODUCTION USAGE! Speed is an issue, and there is zero concurrency. This is PHP afterall.

Getting Started

Simply create a new instance of the Database class, and point it to a writable directory:

$database = new \Pstore\Database("path/to/data");

Then you can get a collection and start to save and retreive any serilisable data:

$collection = $database->getCollection("User");
$collection->save(1, ["name" => "Scott"]);

var_dump($collection->find(1));

/*
array(1) {
  ["name"]=>
  string(5) "Scott"
}
 */