PHPackages                             avoo/serializer-translation - 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. avoo/serializer-translation

AbandonedArchivedSymfony-bundle[Parsing &amp; Serialization](/categories/parsing)

avoo/serializer-translation
===========================

Translation component for JMS Serializer

0.1.1(10y ago)026.1k41MITPHPPHP &gt;=5.3.3

Since Sep 1Pushed 10y ago1 watchersCompare

[ Source](https://github.com/avoo/SerializerTranslation)[ Packagist](https://packagist.org/packages/avoo/serializer-translation)[ RSS](/packages/avoo-serializer-translation/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependencies (1)Versions (3)Used By (1)

SerializerTranslation
=====================

[](#serializertranslation)

[!\[Build Status\] (https://scrutinizer-ci.com/g/avoo/SerializerTranslation/badges/build.png?b=master)](https://scrutinizer-ci.com/g/avoo/SerializerTranslation/build-status/master)[!\[Scrutinizer Code Quality\] (https://scrutinizer-ci.com/g/avoo/SerializerTranslation/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/avoo/SerializerTranslation/?branch=master)[!\[Latest Stable Version\] (https://poser.pugx.org/avoo/serializer-translation/v/stable.svg)](https://packagist.org/packages/avoo/serializer-translation)[!\[License\] (https://poser.pugx.org/avoo/serializer-translation/license.svg)](https://packagist.org/packages/avoo/serializer-translation)

This is a PHP library based on JMS Serializer, and add translation option configuration for any properties.

- [Installation](#installation)
- [Default Usage](#default-usage)
- [With custom parameters](#with-custom-parameters)
    - [XML](#xml)
    - [YAML](#yaml)
    - [Annotations](#annotations)

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

[](#installation)

Require [`avoo/serializer-translation-bundle`](https://packagist.org/packages/avoo/serializer-translation-bundle)into your `composer.json` file:

```
{
    "require": {
        "avoo/serializer-translation-bundle": "@dev-master"
    }
}
```

Register the bundle in `app/AppKernel.php`:

```
// app/AppKernel.php
public function registerBundles()
{
    return array(
        // ...
        new Avoo\SerializerTranslationBundle\AvooSerializerTranslationBundle(),
    );
}
```

Default Configuration
---------------------

[](#default-configuration)

```
# app/config/config.yml

avoo_serializer_translation:
    metadata:
        cache:                file
        file_cache:
            dir:              %kernel.cache_dir%/avoo
```

Default Usage
-------------

[](#default-usage)

For example, you want to translate `acme.foo.bar` from BDD.

#### Default activation

[](#default-activation)

Into your translation file:

```
# Acme/DemoBundle/Resources/translations/messages.en.yml

acme:
    foo.bar: "Welcome."
```

```

```

### YAML

[](#yaml)

```
Acme\DemoBundle\Entity\Sample:
    exclusion_policy: ALL
    xml_root_name: sample
    properties:
        property:
            expose: true
            type: string
            translate: true
```

### Annotations

[](#annotations)

**Important:** The annotation need to be defined.

```
use Avoo\SerializerTranslation\Configuration\Annotation as AvooSerializer;

/**
 * @var string $property
 *
 * @AvooSerializer\Translate()
 */
 protected $property;
```

#### Json output sample

[](#json-output-sample)

```
{
    "property": "welcome."
}
```

With custom parameters
----------------------

[](#with-custom-parameters)

#### With custom parameters

[](#with-custom-parameters-1)

Into your translation file:

```
# Acme/DemoBundle/Resources/translations/messages.en.yml

acme:
    foo.bar: "welcome %foo%"
```

### XML

[](#xml)

```

```

### YAML

[](#yaml-1)

```
Acme\DemoBundle\Entity\Sample:
    exclusion_policy: ALL
    xml_root_name: sample
    properties:
        property:
            expose: true
            type: string
            translate:
                parameters:
                    %foo%: expr(object.getProperty())
                locale: en
                domain: messages
```

### Annotations

[](#annotations-1)

```
use Avoo\SerializerTranslation\Configuration\Annotation as AvooSerializer;

/**
 * @var string $property
 *
 * @AvooSerializer\Translate(
 *     parameters = {
 *         "%foo%" = "expr(object.getProperty())"
 *     },
 *     domain = "messages",
 *     locale = "en"
 * )
 */
 protected $property;
```

#### Json output sample

[](#json-output-sample-1)

```
{
    "property": "welcome Superman",
}
```

License
-------

[](#license)

This bundle is released under the MIT license. See the complete license in the bundle:

[License](https://github.com/avoo/SerializerTranslation/blob/master/LICENSE)

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity49

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

Total

2

Last Release

4003d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6b8ee83ffc36845dc3d1092cd98dbf56fc2cffd8e46b2d04b777959992cb60eb?d=identicon)[avoo](/maintainers/avoo)

---

Top Contributors

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

---

Tags

Serializer translation

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/avoo-serializer-translation/health.svg)

```
[![Health](https://phpackages.com/badges/avoo-serializer-translation/health.svg)](https://phpackages.com/packages/avoo-serializer-translation)
```

###  Alternatives

[mtdowling/jmespath.php

Declaratively specify how to extract elements from a JSON document

2.0k472.8M135](/packages/mtdowling-jmespathphp)[opis/closure

A library that can be used to serialize closures (anonymous functions) and arbitrary data.

2.6k230.0M284](/packages/opis-closure)[masterminds/html5

An HTML5 parser and serializer.

1.8k242.8M229](/packages/masterminds-html5)[sabberworm/php-css-parser

Parser for CSS Files written in PHP

1.8k191.2M65](/packages/sabberworm-php-css-parser)[michelf/php-markdown

PHP Markdown

3.5k52.4M345](/packages/michelf-php-markdown)[jms/metadata

Class/method/property metadata management in PHP

1.8k152.8M88](/packages/jms-metadata)

PHPackages © 2026

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