Skip to content

dwgebler/doclite

Repository files navigation

DocLite

A powerful PHP NoSQL document store built on top of SQLite.

CI

About

DocLite is a NoSQL document store for PHP built on SQLite. It uses the PHP PDO SQLite library to automatically manage documents organised into named collections, stored as JSON. DocLite takes advantage of the SQLite JSON1 extension to store, parse, index, and query JSON documents — giving you the power of a fully transactional, ACID-compliant NoSQL solution contained entirely within the local filesystem.

DocLite lends itself to a variety of use cases: rapid prototyping, small-to-medium websites and applications, a fast local cache for remote API data, a robust replacement for flat-file stores, and a database for microservices or local web apps. Broadly, it suits the same use cases as SQLite itself, but where a NoSQL document model is preferred.

Install

composer require dwgebler/doclite

Requires PHP 8.1+ and the pdo_sqlite extension.

Upgrading from 1.x? See UPGRADE-2.0.md.

Quick start

use Gebler\Doclite\FileDatabase;

$db = new FileDatabase('./data');
$users = $db->collection('users');

$alice = $users->get();
$alice->setValue('name', 'Alice');
$alice->setValue('email', 'alice@example.com');
$alice->save();

$found = $users->findOneBy(['email' => 'alice@example.com']);
echo $found->getValue('name'); // Alice

Documentation

License

MIT. See LICENSE.

Reporting bugs

Please raise an issue on GitHub.

Reporting vulnerabilities

See SECURITY.md.

About

PHP NoSQL database and document store

Topics

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Sponsor this project

Packages

 
 
 

Contributors

Languages