PHPackages                             hshn/serializer-extra-bundle - 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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. hshn/serializer-extra-bundle

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

hshn/serializer-extra-bundle
============================

This bundle provides some extra features for serialization

v0.4.1(11y ago)21.5k1MITPHP

Since Dec 21Pushed 11y ago1 watchersCompare

[ Source](https://github.com/hshn/HshnSerializerExtraBundle)[ Packagist](https://packagist.org/packages/hshn/serializer-extra-bundle)[ RSS](/packages/hshn-serializer-extra-bundle/feed)WikiDiscussions master Synced today

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

HshnSerializerExtraBundle
=========================

[](#hshnserializerextrabundle)

[![Build Status](https://camo.githubusercontent.com/1b3521d5af1d3091843c3627da01e2adbabb7c0f9dcc2ee60c71672b07628172/68747470733a2f2f7472617669732d63692e6f72672f6873686e2f4873686e53657269616c697a6572457874726142756e646c652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/hshn/HshnSerializerExtraBundle) [![Latest Stable Version](https://camo.githubusercontent.com/7ecf94c7f35826238c2271ea289a7a9f869d472abb5faeff0dd3583fbff4416d/68747470733a2f2f706f7365722e707567782e6f72672f6873686e2f73657269616c697a65722d65787472612d62756e646c652f762f737461626c652e737667)](https://packagist.org/packages/hshn/serializer-extra-bundle) [![Total Downloads](https://camo.githubusercontent.com/cccc1e0ab40e45160848d2283be8abf24e1d297de9418eb464436db55d85fff5/68747470733a2f2f706f7365722e707567782e6f72672f6873686e2f73657269616c697a65722d65787472612d62756e646c652f646f776e6c6f6164732e737667)](https://packagist.org/packages/hshn/serializer-extra-bundle) [![Latest Unstable Version](https://camo.githubusercontent.com/7832c8397a36e4430c469fabc7fd6ea646852931523c41384803c3b5fef9628b/68747470733a2f2f706f7365722e707567782e6f72672f6873686e2f73657269616c697a65722d65787472612d62756e646c652f762f756e737461626c652e737667)](https://packagist.org/packages/hshn/serializer-extra-bundle) [![License](https://camo.githubusercontent.com/29751d12f7aeb2dc986136f4d8a8749cae53f84e329dfa5e7345922241bee588/68747470733a2f2f706f7365722e707567782e6f72672f6873686e2f73657269616c697a65722d65787472612d62756e646c652f6c6963656e73652e737667)](https://packagist.org/packages/hshn/serializer-extra-bundle)

This bundle provides some extra features for serialization.

### Exporting authorities of objects

[](#exporting-authorities-of-objects)

```
# app/config.yml
hshn_serializer_extra:
    authority:
        classes:
            AcmeBundle\Entity\Blog:
                attributes: OWNER
```

```
/** @var $serializer JMS\Serializer\Serializer */
$json = $serializer->serialize($blog, 'json');
```

The access authorities provided by `AuthorizationCheckerInterface::isGranted()` will be exported to the attribute '\_authority' when an object was serialized.

```
{
    "key": "value",
    "_authority": {
        "OWNER": true
    }
}
```

#### Overriding the attribute name

[](#overriding-the-attribute-name)

```
# app/config.yml
hshn_serializer_extra:
    authority:
        export_to: "my_authority"
```

```
{
    "key": "value",
    "my_authority": {
        "OWNER": true
    }
}
```

#### Restrict exporting the authorities by depth

[](#restrict-exporting-the-authorities-by-depth)

```
# app/config.yml
hshn_serializer_extra:
    authority:
        classes:
            AcmeBundle\Entity\Blog:
                attributes: [OWNER]
                max_depth: 0 # default -1 (unlimited)
```

```
class Blog
{
}

class User
{
    /**
     * @var Blog
     */
    private $blog;
}

$serializer->serialize($blog, 'json'); // will export the blog authorities (depth 0)
$serializer->serialize($user, 'json'); // will NOT export the blog authorities (depth 1)
```

### Export files as URLs

[](#export-files-as-urls)

> This feature require [VichUploaderBundle](https://github.com/dustin10/VichUploaderBundle)

```
# app/config.yml
hshn_serializer_extra:
    vich_uploader:
        classes:
            AcmeBundle\Entity\Blog:
                files:
                    - { property: picture }
                    - { property: picture, export_to: image }
```

```
/** @var $serializer JMS\Serializer\Serializer */
$json = $serializer->serialize($blog, 'json');
```

Generated URLs will be exported when serializing an object.

```
{
    "picture": "/url/to/picture",
    "image": "/url/to/picture"
}
```

### Export images as URLs

[](#export-images-as-urls)

> This feature require [LiipImagineBundle](https://github.com/liip/LiipImagineBundle)

Adding a filter name specification to a file configuration.

```
# app/config.yml
hshn_serializer_extra:
    vich_uploader:
        classes:
            AcmeBundle\Entity\Blog:
                files:
                    - { property: picture }
                    - { property: picture, export_to: image, filter: thumbnail }
```

```
{
    "picture": "/url/to/picture",
    "image": "/url/to/thumbnail/picture"
}
```

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 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 ~6 days

Total

5

Last Release

4186d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1334026?v=4)[Shota Hoshino](/maintainers/hshn)[@hshn](https://github.com/hshn)

---

Top Contributors

[![hshn](https://avatars.githubusercontent.com/u/1334026?v=4)](https://github.com/hshn "hshn (69 commits)")

### Embed Badge

![Health badge](/badges/hshn-serializer-extra-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/hshn-serializer-extra-bundle/health.svg)](https://phpackages.com/packages/hshn-serializer-extra-bundle)
```

###  Alternatives

[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k17.9M388](/packages/easycorp-easyadmin-bundle)[symfony/web-profiler-bundle

Provides a development tool that gives detailed information about the execution of any request

2.3k160.5M1.2k](/packages/symfony-web-profiler-bundle)[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.

1189.8k](/packages/rcsofttech-audit-trail-bundle)[ecotone/symfony-bundle

Ecotone for Symfony — CQRS, Event Sourcing, Sagas, Durable Workflows, and Outbox on top of Symfony Messenger, via PHP attributes.

11249.0k1](/packages/ecotone-symfony-bundle)[2lenet/crudit-bundle

The easy like Crud'it Bundle.

1616.4k12](/packages/2lenet-crudit-bundle)

PHPackages © 2026

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