Lazer Database
activeby Grzegorz Kuźnik and the Lazer-Database contributors · since 2013 · also known as Lazer, Lazer-Database, greg0/lazer-database
PHP library that treats JSON files as database tables, with an ORM-style query builder and relations.
Overview
Lazer is a small PHP library, started by Grzegorz Kuźnik in 2013 and now maintained under the Lazer-Database GitHub organisation, that stores each table as a JSON data file plus a JSON schema file. A fluent, ORM-inspired API lets you create tables with typed fields, insert and update rows, filter with where/orWhere, order, limit, group and count, and define belongsTo and hasMany relations that join across tables. It needs only PHP 7.2+ and Composer, so it suits shared hosting, small CMS-style sites and tools where SQLite is unavailable or overkill. Everything is loaded and rewritten in PHP, so it is unsuitable for concurrency or large tables. It is still maintained, with 2.0.6 released in October 2026.
Strengths & trade-offs
Strengths
- +Zero-dependency persistence for PHP: just JSON files and Composer
- +Fluent API with where, order, limit, group and count
- +belongsTo/hasMany relations across tables
- +Database files can be moved or versioned like any other files
Trade-offs
- −No transactions or safe concurrent writes
- −Loads whole tables into memory; slows down quickly as data grows
- −Small maintainer base
Great for
- +Small PHP sites on hosts without a database server
- +Prototypes and admin tools needing simple structured storage
- +Config or content stored as diff-able JSON files
Think twice for
- −Concurrent multi-user writes
- −Tables beyond tens of thousands of rows
Capabilities
Native or official first-party support · 3 of 25 tracked
Scale & consistency
- Comfortable data size
- Small · ≤ 100 GB
- Horizontal scaling
- None
- Multi-region
- No
- Transactions
- None
- Consistency
- Strong
- Schema
- Strict
- Architecture
- Embedded
- Query languages
- PHP fluent query API
Whole JSON files are read and rewritten; practical for small tables only.
Deployment
Ecosystem
Alternatives to Lazer Database
The in-process SQL engine that ships in every phone, browser and OS: one file, zero servers.
lazer vs sqlite →Dependency-free PHP library that stores schemaless documents as plain JSON files on disk.
lazer vs sleekdb →Tiny type-safe local JSON database for Node, Electron and the browser using plain JavaScript.
lazer vs lowdb →Pure-Python document store that keeps every table in one human-readable JSON file.
lazer vs tinydb →Tiny pure-Ruby and pure-Python DBMS that stores tables as plain-text files.
lazer vs kirbybase →Open-source backend in one Go binary: SQLite database, auth, files, realtime and admin UI.
lazer vs pocketbase →Lazer Database FAQ
What is Lazer Database?
Lazer Database is a document database by Grzegorz Kuźnik and the Lazer-Database contributors, first released in 2013. Lazer is a small PHP library, started by Grzegorz Kuźnik in 2013 and now maintained under the Lazer-Database GitHub organisation, that stores each table as a JSON data file plus a JSON schema file. A fluent, ORM-inspired API lets you create tables with typed fields, insert and update rows, filter with where/orWhere, order, limit, group and count, and define belongsTo and hasMany relations that join across tables. It needs only PHP 7.2+ and Composer, so it suits shared hosting, small CMS-style sites and tools where SQLite is unavailable or overkill. Everything is loaded and rewritten in PHP, so it is unsuitable for concurrency or large tables. It is still maintained, with 2.0.6 released in October 2026.
Is Lazer Database open source?
Yes. Lazer Database is open source. License: MIT License.
Does Lazer Database support ACID transactions?
No. Lazer Database does not provide ACID transactions; its consistency model is strong.
Does Lazer Database scale horizontally?
Lazer Database does not scale horizontally; it runs on a single node, so you scale it up rather than out. It is comfortable at small scale (≤ 100 GB).
How can I run Lazer Database?
You can self-host it and embed it in your application.
What is Lazer Database best for?
Lazer Database is a strong fit for small PHP sites on hosts without a database server; prototypes and admin tools needing simple structured storage; and config or content stored as diff-able JSON files. Think twice for concurrent multi-user writes.
What are the best alternatives to Lazer Database?
Common alternatives to Lazer Database include SQLite, SleekDB, lowdb, TinyDB and KirbyBase. The right choice depends on your workload, scale and hosting; WhichDB's smart match ranks them against your requirements.
How popular is Lazer Database?
Lazer Database ranks #555 of 844 databases on the WhichDB Score (1.4/100), and #49 among document databases. The score combines public adoption signals such as package downloads, GitHub activity, job posts and developer discussion.

