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(9y ago)97.0k11MITPHPPHP &gt;=5.5

Since May 6Pushed 9y 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 2mo 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 72% 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

3632d 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

[knplabs/doctrine-behaviors

Doctrine Behavior Traits

92212.7M64](/packages/knplabs-doctrine-behaviors)[scienta/doctrine-json-functions

A set of extensions to Doctrine that add support for json query functions.

58523.9M36](/packages/scienta-doctrine-json-functions)[laravel-doctrine/orm

An integration library for Laravel and Doctrine ORM

8425.3M87](/packages/laravel-doctrine-orm)[fresh/doctrine-enum-bundle

Provides support of ENUM type for Doctrine2 in Symfony applications.

4636.8M12](/packages/fresh-doctrine-enum-bundle)[damienharper/auditor-bundle

Integrate auditor library in your Symfony projects.

4542.8M](/packages/damienharper-auditor-bundle)[prezent/doctrine-translatable

Translatable behaviour extension for Doctrine

26754.3k5](/packages/prezent-doctrine-translatable)

PHPackages © 2026

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