A powerful PHP NoSQL document store built on top of SQLite.
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.
composer require dwgebler/docliteRequires PHP 8.1+ and the pdo_sqlite extension.
Upgrading from 1.x? See UPGRADE-2.0.md.
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- Getting started — installation, requirements, your first database
- Collections & documents — CRUD, transactions, schemas, custom class mapping
- Queries — query builder, joins, pagination, aggregation, indexing
- Full-text search — FTS5-powered search
- Advanced — import/export, journal modes, JSONB, PSR-16 cache adapter, logging
- Symfony integration — wiring DocLite into a Symfony app
MIT. See LICENSE.
Please raise an issue on GitHub.
See SECURITY.md.