PHPackages                             dunglas/doctrine-json-odm - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. dunglas/doctrine-json-odm

ActiveLibrary[Database &amp; ORM](/categories/database)

dunglas/doctrine-json-odm
=========================

An object document mapper for Doctrine ORM using JSON types of modern RDBMS.

v1.5.0(4mo ago)6285.0M↓13.9%73[6 issues](https://github.com/dunglas/doctrine-json-odm/issues)[4 PRs](https://github.com/dunglas/doctrine-json-odm/pulls)9MITPHPPHP &gt;=8.1CI passing

Since Apr 3Pushed 3mo ago18 watchersCompare

[ Source](https://github.com/dunglas/doctrine-json-odm)[ Packagist](https://packagist.org/packages/dunglas/doctrine-json-odm)[ Docs](https://dunglas.dev)[ GitHub Sponsors](https://github.com/dunglas)[ Fund](https://tidelift.com/funding/github/packagist/dunglas/doctrine-json-odm)[ RSS](/packages/dunglas-doctrine-json-odm/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (12)Versions (17)Used By (9)

Doctrine JSON ODM
=================

[](#doctrine-json-odm)

An Object-Document Mapper (ODM) for [Doctrine ORM](http://www.doctrine-project.org/projects/orm.html) leveraging new JSON types of modern RDBMS.

[![tests](https://github.com/dunglas/doctrine-json-odm/actions/workflows/tests.yml/badge.svg)](https://github.com/dunglas/doctrine-json-odm/actions/workflows/tests.yml)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/b70ced811fc263d01f49522e768a4678ad4c3969ae8670e95d492a493cd9fb77/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f64756e676c61732f646f637472696e652d6a736f6e2d6f646d2f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/dunglas/doctrine-json-odm/?branch=master)[![StyleCI](https://camo.githubusercontent.com/62103cb170d9005db18fc52245e67b98710cdb091fa8f804c8f5328f4457314e/68747470733a2f2f7374796c6563692e696f2f7265706f732f35373232333832362f736869656c64)](https://styleci.io/repos/57223826)

Did you ever dream of a tool creating powerful data models mixing traditional, efficient relational mappings with modern schema-less and NoSQL-like ones?

With Doctrine JSON ODM, it's now possible to create and query such hybrid data models with ease. Thanks to [modern JSON types of RDBMS](http://www.postgresql.org/docs/current/static/datatype-json.html), querying schema-less documents is easy, powerful and [fast as hell (similar in performance to a MongoDB database)](http://www.enterprisedb.com/postgres-plus-edb-blog/marc-linster/postgres-outperforms-mongodb-and-ushers-new-developer-reality)! You can even [define indexes](http://www.postgresql.org/docs/current/static/datatype-json.html#JSON-INDEXING) for those documents.

Doctrine JSON ODM allows to store PHP objects as JSON documents in modern, dynamic columns of an RDBMS. It works with JSON and JSONB columns of PostgreSQL (&gt;= 9.4) and the JSON column type of MySQL (&gt;= 5.7.8).

For more information about concepts behind Doctrine JSON ODM, take a look at [the presentation given by Benjamin Eberlei at Symfony Catalunya 2016](https://www.youtube.com/watch?v=E8w1y1Jo7YI).

Install
-------

[](#install)

To install the library, use [Composer](https://getcomposer.org/), the PHP package manager:

```
composer require dunglas/doctrine-json-odm

```

If you are using [Symfony](https://symfony.com) or [API Platform](https://api-platform.com), you don't need to do anything else! If you use Doctrine directly, use a bootstrap code similar to the following:

```
