Search by

crustum / cakephp-mongo-odm

skiedr

MongoDB ODM for CakePHP: Cake-style collections, documents, fluent query builder over aggregation pipelines, associations, behaviors, validation, migrations, Bake code generation and an ORM bridge

Package info

github.com/Crustum/cakephp-mongo-odm

Type:cakephp-plugin

pkg:composer/crustum/cakephp-mongo-odm

Statistics

Installs: 10

Dependents: 0

Suggesters: 1

Stars: 1

Open Issues: 0

5.0.0 2026-12-01 19:32 UTC

This package is auto-updated.

Last update: 2026-12-01 20:42:19 UTC


README

CakePHP Mongo is a MongoDB ODM with direct ORM parity. Collections correspond to tables and documents to entities, with the same find, save and delete flow, validation, rules, behaviors, events and containable associations. ORM knowledge transfers without relearning, and MongoDB code follows the same conventions, locators and Bake workflows as SQL code.

Documents support nesting under a typed schema. Field types, indexes and JSON schema validators are defined through migrations, and validation runs against that schema. Alongside the classic hasOne, hasMany, belongsTo and belongsToMany, the ODM adds embedOne and embedMany for data stored inside the parent document, plus DBRef references. Queries compile to find and aggregation pipelines, with lookup based eager loading, full text, geospatial and vector search, JSON schema validation, versioned migrations, and transactions.

Mixed SQL and MongoDB applications are supported through an ORM to ODM association bridge. Tables and collections link across the boundary with contain loading, cascade delete and controlled saves. Mongo backed cache, lock and session engines are included, with standalone, replica set and Atlas deployments covered.

Requirements

  • PHP 8.4+

See Versions.md for the supported CakePHP versions.

Installation

Installation into a CakePHP application is done with composer:

composer require crustum/cakephp-mongo-odm

Load the plugin:

bin/cake plugin load Crustum/Mongo

Documentation

For documentation, as well as tutorials, see the docs directory of this repository.

License

Licensed under the MIT License. Redistributions of the source code included in this repository must retain the copyright notice found in each file.