PHPackages                             alcalyn/serializer-doctrine-proxies - 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. alcalyn/serializer-doctrine-proxies

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

alcalyn/serializer-doctrine-proxies
===================================

Provides Doctrine proxies handler for JMS Serializer to disable lazy-loading and recursion during serialization.

1.1.2(10y ago)97.0k11MITPHPPHP &gt;=5.5

Since May 6Pushed 10y agoCompare

[ Source](https://github.com/alcalyn/serializer-doctrine-proxies)[ Packagist](https://packagist.org/packages/alcalyn/serializer-doctrine-proxies)[ Docs](https://github.com/alcalyn/serializer-doctrine-proxies)[ RSS](/packages/alcalyn-serializer-doctrine-proxies/feed)WikiDiscussions master Synced 6d ago

READMEChangelog (4)Dependencies (3)Versions (5)Used By (1)

Serialize Doctrine Proxies
==========================

[](#serialize-doctrine-proxies)

[![Latest Stable Version](https://camo.githubusercontent.com/bdb59a686f6d062cc089f2126e470844eebd2188aec48bb6db9f1d2df69f1a46/68747470733a2f2f706f7365722e707567782e6f72672f616c63616c796e2f73657269616c697a65722d646f637472696e652d70726f786965732f762f737461626c65)](https://packagist.org/packages/alcalyn/serializer-doctrine-proxies)[![Total Downloads](https://camo.githubusercontent.com/19b703d6f598941f611bca227af4a860066de64d35a8d751ec73763377ef7564/68747470733a2f2f706f7365722e707567782e6f72672f616c63616c796e2f73657269616c697a65722d646f637472696e652d70726f786965732f646f776e6c6f616473)](https://packagist.org/packages/alcalyn/serializer-doctrine-proxies)[![License](https://camo.githubusercontent.com/2b0af4d28a2cd7921ffbf78bf883bed6e4963a3ae6a17fc048fbec5dbd3f0f1c/68747470733a2f2f706f7365722e707567782e6f72672f616c63616c796e2f73657269616c697a65722d646f637472696e652d70726f786965732f6c6963656e7365)](https://packagist.org/packages/alcalyn/serializer-doctrine-proxies)

Provides Doctrine proxies handler for JMS Serializer to disable lazy-loading and recursion during serialization.

This library solves problems discussed on Stack Overflow, in [this thread](http://stackoverflow.com/questions/11575345/disable-doctrine-2-lazy-loading-when-using-jms-serializer), or [this one](http://stackoverflow.com/questions/11851197/avoiding-recursion-with-doctrine-entities-and-jmsserializer), and is inspired by [this gist](https://gist.github.com/Jaap-van-Hengstum/0d400ea4f986d8f8a044).

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

[](#installation)

Using [Composer](https://packagist.org/packages/alcalyn/serializer-doctrine-proxies):

```
{
    "require": {
        "alcalyn/serializer-doctrine-proxies": "1.x"
    }
}
```

Usage
-----

[](#usage)

You have to add a handler and a listener to your Serializer instance. Here using SerializerBuilder:

```
use Alcalyn\SerializerDoctrineProxies\DoctrineProxyHandler;
use Alcalyn\SerializerDoctrineProxies\DoctrineProxySubscriber;
use JMS\Serializer\EventDispatcher\EventDispatcher;
use JMS\Serializer\Handler\HandlerRegistryInterface;
use JMS\Serializer\SerializerBuilder;

$serializer = SerializerBuilder::create()
    ->addDefaultHandlers() // This line to avoid to default handlers to be overrided by the new one.
    ->configureHandlers(function (HandlerRegistryInterface $handlerRegistry) {
        $handlerRegistry->registerSubscribingHandler(new DoctrineProxyHandler());
    })
    ->configureListeners(function (EventDispatcher $dispatcher) {
        $dispatcher->addSubscriber(new DoctrineProxySubscriber(false)); // false to disable lazy loading.
    })
    ->build()
;

$serializer->serialize($myEntityWithABunchOfRelationsIDontWantToLazyLoadDuringSerialization);
```

License
-------

[](#license)

This project is under [MIT](LICENSE).

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~9 days

Total

4

Last Release

3727d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/17f0c4d65197a7aed6ecc8fdedd5a097c7238c9be19aca08c92c05d38fd8c29e?d=identicon)[alcalyn](/maintainers/alcalyn)

---

Top Contributors

[![alcalyn](https://avatars.githubusercontent.com/u/1588144?v=4)](https://github.com/alcalyn "alcalyn (5 commits)")

---

Tags

doctrineserializer

### Embed Badge

![Health badge](/badges/alcalyn-serializer-doctrine-proxies/health.svg)

```
[![Health](https://phpackages.com/badges/alcalyn-serializer-doctrine-proxies/health.svg)](https://phpackages.com/packages/alcalyn-serializer-doctrine-proxies)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.5k6.0M777](/packages/sylius-sylius)[rcsofttech/audit-trail-bundle

Enterprise-grade, high-performance Symfony audit trail bundle. Automatically track Doctrine entity changes with split-phase architecture, multiple transports (HTTP, Queue, Doctrine), and sensitive data masking.

12017.1k](/packages/rcsofttech-audit-trail-bundle)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.4M232](/packages/sulu-sulu)[2lenet/crudit-bundle

The easy like Crud'it Bundle.

1617.3k16](/packages/2lenet-crudit-bundle)[api-platform/doctrine-orm

Doctrine ORM bridge

314.8M106](/packages/api-platform-doctrine-orm)[neos/media

The Media package

101.2M57](/packages/neos-media)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
