Skip to content
John James Jacoby edited this page May 27, 2026 · 2 revisions

BerlinDB

BerlinDB is a small database layer for WordPress-oriented PHP applications that want custom database tables without giving up familiar WordPress conventions.

It provides an ORM-like shape around five core objects:

  • Table manages the physical database table and its lifecycle.
  • Schema describes columns and indexes.
  • Column describes one database column and how values are validated, cast, queried, and created.
  • Row shapes raw database records into application objects.
  • Query reads and writes rows, builds SQL, manages cache keys, and delegates clause parsing to parser objects.

Version 3.0.0 also introduces a clearer internal structure:

  • Adapters wrap database connections.
  • Interfaces define database contracts.
  • Kern contains the core table, schema, row, query, column, and index objects.
  • Operators build individual SQL comparisons.
  • Parsers turn query vars into SQL clauses.
  • Traits provide shared boot, lifecycle, logging, parsing, environment, and sanitization behavior.

Start Here

If you are new to BerlinDB, read these in order:

  1. Architecture
  2. Installation
  3. Setting Up Your First Table
  4. Writing Queries
  5. Managing Tables and Upgrades

Common Tasks

Status

BerlinDB is a library for custom database tables. It is not a complete application framework, and it intentionally keeps close to WordPress database behavior. When in doubt, prefer explicit schemas, explicit query classes, and small wrappers in your own plugin or application.

Clone this wiki locally