Skip to content

storh

storh is a standalone PHP datastore built around files: JSONC documents, an append-only segmented log, and an append-only queue. It stores records with UUIDv7 ids, supports streaming reads and cursor or time-range queries, and uses atomic filesystem operations instead of a database server.

Callers provide a directory. storh does not discover application paths, read global constants, or require a framework adapter.

Engines

  • DocStore stores one JSONC file per record with UUID-tail-sharded paths. Best for point reads by id and indexed field queries.
  • SegmentedLog appends records to segment files as JSON lines guarded by a byte length and checksum prefix. Best for append-heavy streams with cursor and time-range reads.
  • Queue appends durable job events and keeps queue state in memory. Best for durable work dispatch between processes.

Unsure which one fits your workload? See Choosing an engine for a side-by-side comparison.

DocStore, SegmentedLog, and Queue are class aliases of the implementation classes DocPerFileStore, SegmentedLogStore, and LogQueue, so both names refer to the same class.

Requirements

  • PHP 8.2 or later
  • ext-json
  • a local or mounted filesystem with atomic rename semantics inside a directory

Where to next