PHPackages                             vuryss/doctrine-lazy-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. vuryss/doctrine-lazy-json-odm

ActiveSymfony-bundle

vuryss/doctrine-lazy-json-odm
=============================

A high-performance Doctrine JSON ODM with lazy loading using vuryss/serializer v4

v3.0.0(2mo ago)11.3k↓33.3%MITPHPPHP ^8.5CI passing

Since Aug 20Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/vuryss/doctrine-lazy-json-odm)[ Packagist](https://packagist.org/packages/vuryss/doctrine-lazy-json-odm)[ RSS](/packages/vuryss-doctrine-lazy-json-odm/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)Dependencies (30)Versions (8)Used By (0)

Doctrine Lazy JSON ODM Bundle
=============================

[](#doctrine-lazy-json-odm-bundle)

A high-performance Symfony bundle that provides a Doctrine JSON ODM (Object Document Mapper) with advanced lazy loading capabilities. This bundle stores complex object structures as JSON in database fields while providing transparent lazy loading to improve performance.

[![PHP Version](https://camo.githubusercontent.com/3fe1b9f28029d16b30242054cf5a6fe168f12cee4d294ec395f5bca64b874909/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344382e352d626c7565)](https://www.php.net/)

Features
--------

[](#features)

- **🚀 Lazy Loading**: Uses PHP 8.5 lazy objects for deferred JSON deserialization
- **⚡ Serializer**: Uses vuryss/serializer v4 for maximum performance
- **🎯 Type Mapping**: Map class names to aliases for storage optimization
- **📦 Collection Support**: Lazy-loaded arrays of objects with transparent usage
- **📊 Performance Optimized**: Significant memory and CPU savings for unused data

Requirements
------------

[](#requirements)

- PHP 8.5 or higher
- Symfony 7.4 LTS or 8.x
- Doctrine ORM 3.6+

Installation
------------

[](#installation)

Install the bundle via Composer:

```
composer require vuryss/doctrine-lazy-json-odm
```

Register the bundle in your `config/bundles.php`:

```
return [
    // ...
    \Vuryss\DoctrineLazyJsonOdm\DoctrineLazyJsonOdmBundle::class => ['all' => true],
];
```

Configuration
-------------

[](#configuration)

Create a configuration file `config/packages/doctrine_lazy_json_odm.yaml`:

```
doctrine_json_odm:
    type_map:
        user: 'App\Entity\User'
        product: 'App\Entity\Product'
        order: 'App\Entity\Order'
    cache_pool: 'app.doctrine_lazy_json_odm.cache_pool'
```

Usage
-----

[](#usage)

### Basic Entity Definition

[](#basic-entity-definition)

Define your entities with JSON ODM fields using the `LazyJsonDocumentType`:

```
