lephare / doctrine-json-translation-bundle
Integrate le-phare/doctrine-json-translation in Symfony
Package info
github.com/le-phare/doctrine-json-translation-bundle
pkg:composer/lephare/doctrine-json-translation-bundle
v1.0.0
2026-03-09 14:53 UTC
Requires
- php: ^8.2
- lephare/doctrine-json-translation: ^2.0
- symfony/config: ^7.4|^8.0
- symfony/dependency-injection: ^7.4|^8.0
- symfony/http-kernel: ^7.4|^8.0
Requires (Dev)
- ekino/phpstan-banned-code: ^3.1
- friendsofphp/php-cs-fixer: ^3.94
- kubawerlos/php-cs-fixer-custom-fixers: ^3.36
- phpstan/phpstan: ^2.1
This package is auto-updated.
Last update: 2026-03-09 14:56:37 UTC
README
Table of Contents
Features
- Doctrine type to store translations in multiple locales in JSON format
- Symfony form type to edit translations
Installation
composer require lephare/doctrine-json-translation-bundle
Usage
1. Configure Doctrine
First, you need to register the custom translated type in your Doctrine configuration.
Add this to config/packages/doctrine.yaml:
# config/packages/doctrine.yaml doctrine: dbal: types: LePhare\DoctrineJsonTranslation\DBAL\TranslatedType
2. Use in an entity
#[ORM\Column(type: 'translated')] protected TranslatedField $title;
3. Use in a form
use LePhare\DoctrineJsonTranslation\Form\Type\TranslatedType; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; class ExampleType extends AbstractType { public function buildForm(FormBuilderInterface $builder, array $options): void { $builder ->add('title', TranslatedType::class) ; } }