Skip to content

Daycry Doctrine

Doctrine ORM 3 integration for CodeIgniter 4 — a configured EntityManager, per-group multi-database support, query/result/metadata caching and Second-Level Cache, a safe server-side DataTables Builder, a debug-toolbar collector and Spark / ORM CLI tooling. Backward-compatible and production-ready.

Get started DataTables GitHub

Features

  • EntityManager, your way


    Use it as a service, a helper or a plain object. getEm() with null-guards, reOpen() that actually reconnects a stale worker connection, and SSL / custom DBAL options passthrough.

    Usage

  • Server-side DataTables


    Filtering, ordering and pagination with safe operator parsing, whitelisted columns, page-size and filter-value caps, fetchJoinCollection opt-out and injectable totals.

    DataTables

  • Bracket search operators


    Per-column [%] [=] [!=] [>] [<] [IN] [OR] [><] with case-insensitive support and strict, documented validation — regex: true is rejected by design.

    Search Modes

  • Caching & Second-Level Cache


    Query / result / metadata caches backed by Config\Cache, per-group namespacing, the getFromCacheOrQuery() cache-aside helper, and Doctrine SLC with an optional stats badge.

    Second-Level Cache

  • :material-database-multiple:{ .lg .middle } Multi-database groups


    Every Config\Database group resolves to its own cached Doctrine instance and isolated cache namespaces — and the ORM CLI can target any group with --em=<group>.

    CLI Commands

  • Extensible by config


    Register custom DBAL Types, SQL Filters (soft-delete / multi-tenant), event listeners/subscribers, DBAL middlewares and a default repository class — all re-applied on reOpen().

    Configuration

  • Debug toolbar & logging


    A toolbar collector captures every DBAL query (debug only), with an SLC hit/miss/put badge — plus opt-in PSR-3 production query logging with a slow-query threshold.

    Debug Toolbar

  • Spark & ORM CLI


    doctrine:publish, doctrine:cache:clear, doctrine:validate, doctrine:info, doctrine:schema:update, plus the full Doctrine ORM console via cli-config.php.

    CLI Commands

Quick start

composer require daycry/doctrine
php spark doctrine:publish
$doctrine = \Config\Services::doctrine();
$user     = $doctrine->em->getRepository(\App\Models\Entity\User::class)->find(1);

See Installation and Configuration to get going, or jump to the DataTables Builder.

Requirements

  • PHP ≥ 8.2
  • CodeIgniter ^4
  • Doctrine ORM ^3, DBAL ^4
  • Symfony Cache ^7