PHPackages                             softspring/doctrine-simple-translation-type-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. [Database &amp; ORM](/categories/database)
4. /
5. softspring/doctrine-simple-translation-type-bundle

Abandoned → [softspring/translatable-bundle](/?search=softspring%2Ftranslatable-bundle)Symfony-bundle[Database &amp; ORM](/categories/database)

softspring/doctrine-simple-translation-type-bundle
==================================================

This package provides a simple translation type for doctrine using JSON type.

v5.3.15(1y ago)010.1k[1 PRs](https://github.com/softspring/doctrine-simple-translation-type-bundle/pulls)MITPHPPHP &gt;=8.1CI passing

Since Feb 21Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/softspring/doctrine-simple-translation-type-bundle)[ Packagist](https://packagist.org/packages/softspring/doctrine-simple-translation-type-bundle)[ RSS](/packages/softspring-doctrine-simple-translation-type-bundle/feed)WikiDiscussions 5.3 Synced 2mo ago

READMEChangelog (10)Dependencies (8)Versions (88)Used By (0)

Doctrine simple translation type bundle
=======================================

[](#doctrine-simple-translation-type-bundle)

[![Latest Stable](https://camo.githubusercontent.com/ee060b9e402bf89df823ca9095d4af8b488b44cd8781f1ed6ce15b6b26252ed6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f736f6674737072696e672f646f637472696e652d73696d706c652d7472616e736c6174696f6e2d747970652d62756e646c653f6c6162656c3d737461626c65267374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/ee060b9e402bf89df823ca9095d4af8b488b44cd8781f1ed6ce15b6b26252ed6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f736f6674737072696e672f646f637472696e652d73696d706c652d7472616e736c6174696f6e2d747970652d62756e646c653f6c6162656c3d737461626c65267374796c653d666c61742d737175617265)[![Latest Unstable](https://camo.githubusercontent.com/f8121dcb740b876db4aa224d422278a15e08a9c7f86ecaa4ca1db30466204b63/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f736f6674737072696e672f646f637472696e652d73696d706c652d7472616e736c6174696f6e2d747970652d62756e646c653f6c6162656c3d756e737461626c65267374796c653d666c61742d73717561726526696e636c7564655f70726572656c6561736573)](https://camo.githubusercontent.com/f8121dcb740b876db4aa224d422278a15e08a9c7f86ecaa4ca1db30466204b63/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f736f6674737072696e672f646f637472696e652d73696d706c652d7472616e736c6174696f6e2d747970652d62756e646c653f6c6162656c3d756e737461626c65267374796c653d666c61742d73717561726526696e636c7564655f70726572656c6561736573)[![License](https://camo.githubusercontent.com/eb60314b6fd465c62ebacff721c5ff638d345a7649f1325e703dee08910982cc/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f736f6674737072696e672f646f637472696e652d73696d706c652d7472616e736c6174696f6e2d747970652d62756e646c653f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/eb60314b6fd465c62ebacff721c5ff638d345a7649f1325e703dee08910982cc/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f736f6674737072696e672f646f637472696e652d73696d706c652d7472616e736c6174696f6e2d747970652d62756e646c653f7374796c653d666c61742d737175617265)[![PHP Version](https://camo.githubusercontent.com/daad620ea43792531e7f200d1937e98906ea7341bbc8010c0b4e12b9bd729083/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f736f6674737072696e672f646f637472696e652d73696d706c652d7472616e736c6174696f6e2d747970652d62756e646c652f7068703f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/daad620ea43792531e7f200d1937e98906ea7341bbc8010c0b4e12b9bd729083/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f736f6674737072696e672f646f637472696e652d73696d706c652d7472616e736c6174696f6e2d747970652d62756e646c652f7068703f7374796c653d666c61742d737175617265)[![Downloads](https://camo.githubusercontent.com/10debf7efa50c572cd15c0218ac0d2f8fee751f50852ac945fb334ef9a123ce1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f736f6674737072696e672f646f637472696e652d73696d706c652d7472616e736c6174696f6e2d747970652d62756e646c653f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/10debf7efa50c572cd15c0218ac0d2f8fee751f50852ac945fb334ef9a123ce1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f736f6674737072696e672f646f637472696e652d73696d706c652d7472616e736c6174696f6e2d747970652d62756e646c653f7374796c653d666c61742d737175617265)[![CI](https://camo.githubusercontent.com/39ef9a5ab668337f8d53b1ff5137dc72041b72b4f1b81200502d5dd7ae3b4818/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f736f6674737072696e672f646f637472696e652d73696d706c652d7472616e736c6174696f6e2d747970652d62756e646c652f63692e796d6c3f6272616e63683d352e33267374796c653d666c61742d737175617265266c6162656c3d4349)](https://github.com/softspring/doctrine-simple-translation-type-bundle/actions/workflows/ci.yml)

This package provides a simple translation type for Doctrine, and its Symfony integration bundle.

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

[](#installation)

### Applications that use Symfony Flex

[](#applications-that-use-symfony-flex)

Open a command console, enter your project directory and execute:

```
$ composer require softspring/doctrine-simple-translation-type-bundle
```

Configure
---------

[](#configure)

Configure the Doctrine type:

```
# config/packages/doctrine.yaml

doctrine:
    dbal:
        types:
            simple_translation: 'Softspring\DoctrineSimpleTranslationTypeBundle\Doctrine\Type\SimpleTranslationType'

```

Usage
-----

[](#usage)

### Configure entity that uses the type

[](#configure-entity-that-uses-the-type)

```
use Doctrine\ORM\Mapping as ORM;

/**
 * @var SimpleTranslation
 * @ORM\Column(name="translated_name", type="simple_translation", nullable=false)
 */
protected $translatedName;

public function __construct()
{
    $this->translatedName = new SimpleTranslation();
}

/**
 * @return SimpleTranslation
 */
public function getName(): SimpleTranslation
{
    return $this->translatedName;
}

/**
 * @param SimpleTranslation $translatedName
 */
public function setName(SimpleTranslation $translatedName): void
{
    $this->translatedName = $translatedName;
}

```

### Manage the model

[](#manage-the-model)

The model class is *Softspring\\DoctrineSimpleTranslationTypeBundle\\Model\\SimpleTranslation*.

**Set the default translation**

```
$entity->getName()->setDefaultLocale('es');
$entity->getName()->setTranslation(null, 'Nombre de la entidad'); // null means default locale
$entity->getName()->setTranslation('es', 'Nombre de la entidad'); // it's also posible to specify the locale

```

**Add additional translations**

```
$entity->getName()->setTranslation('en', 'Entity name');

```

**Get the value**

```
$entity->getName()->translate(); // returns the default value 'Nombre de la entidad'
$entity->getName()->translate('es'); // returns 'Nombre de la entidad'
$entity->getName()->translate('en'); // returns 'Entity name'

```

**Use the full methods**

```
$entity->getName()->getTranslations(); // returns ['es'=>'Nombre de la entidad', 'en'=>'Entity name']
$entity->getName()->setTranslations(['es'=>'Nombre de la entidad', 'en'=>'Entity name']);

```

**Use it as array**

The model implements ArrayAccess, so it's possible to use it as an array:

```
$entity->getName()['en']; // returns 'Entity name'
$entity->getName()['es']; // returns 'Nombre de la entidad'

```

### Twig usage

[](#twig-usage)

```
{{ entity.name|translate }} {# returns 'Nombre de la entidad' if app.request.locale is 'es' #}
{{ entity.name|translate('es') }} {# returns 'Nombre de la entidad' #}
{{ entity.name|translate('en') }} {# returns 'Entity name' #}

```

### Edit values in forms

[](#edit-values-in-forms)

You can use the *Softspring\\DoctrineSimpleTranslationTypeBundle\\Form\\SimpleTranslationType*

```
use Symfony\Component\Form\FormBuilderInterface;

public function buildForm(FormBuilderInterface $builder, array $options)
{
    $builder->add('translatedName'); // automatically uses the SimpleTranslationType thanks to the TypeGuesser
}

```

**Force languages**

```
$builder->add('translatedName', SimpleTranslationType::class, [
    'languages' => ['es','en','de'],
]);

```

###  Health Score

49

—

FairBetter than 94% of packages

Maintenance68

Regular maintenance activity

Popularity22

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity81

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 90.9% 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 ~20 days

Recently: every ~0 days

Total

85

Last Release

556d ago

Major Versions

v1.0.0 → 4.0.02022-02-09

v4.1.1 → v5.0.22023-02-01

PHP version history (3 changes)4.0.0PHP &gt;=7.4

v5.0.4PHP &gt;=8.0

v5.2.5PHP &gt;=8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/64ac79c0e14e0dd67af72d74bd3531606fb0484230c519a35682d54490f9be5b?d=identicon)[softspring](/maintainers/softspring)

---

Top Contributors

[![javihgil](https://avatars.githubusercontent.com/u/2581053?v=4)](https://github.com/javihgil "javihgil (60 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (6 commits)")

---

Tags

componentdoctrinesymfony-bundle

###  Code Quality

Static AnalysisPHPStan, Rector

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/softspring-doctrine-simple-translation-type-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/softspring-doctrine-simple-translation-type-bundle/health.svg)](https://phpackages.com/packages/softspring-doctrine-simple-translation-type-bundle)
```

###  Alternatives

[sylius/sylius

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

8.4k5.6M647](/packages/sylius-sylius)[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k16.7M308](/packages/easycorp-easyadmin-bundle)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[sonata-project/entity-audit-bundle

Audit for Doctrine Entities

644989.8k1](/packages/sonata-project-entity-audit-bundle)[sulu/sulu

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

1.3k1.3M151](/packages/sulu-sulu)[contao/core-bundle

Contao Open Source CMS

1231.6M2.3k](/packages/contao-core-bundle)

PHPackages © 2026

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