Download the PHP package janwebdev/translatable-entity-bundle without Composer
On this page you can find all versions of the php package janwebdev/translatable-entity-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download janwebdev/translatable-entity-bundle
More information about janwebdev/translatable-entity-bundle
Files in janwebdev/translatable-entity-bundle
Package translatable-entity-bundle
Short Description Make Entity translatable
License MIT
Homepage https://github.com/janwebdev/translatable-entity-bundle
Informations about the package translatable-entity-bundle
Symfony Bundle for Making Translatable Entities
A modern Symfony bundle for creating translatable entities with support for PHP 8.2+ and Symfony 6.4/7.x.
Features
- 🚀 Modern PHP 8.2+ - Full type safety with typed properties and return types
- ⚡ Performance Optimized - Reflection caching and efficient translation lookups
- 🎯 Symfony 7.x Ready - Uses modern Symfony attributes and autowiring
- 🔄 Flexible Fallback System - Configurable translation fallback mechanisms
- 📦 Easy Integration - Simple setup with Doctrine ORM
Table of Contents
- Requirements
- Installation
- Enable the Bundle
- Creating Translatable Entities
- Usage in Controllers
- Repository Examples
- Form Integration
- Customizing Translation Behavior
- Testing
Requirements
- PHP: 8.2 or higher
- Symfony: 6.4 or higher
- Doctrine ORM: 2.19 or 3.x
Installation
Install the bundle via Composer:
Enable the Bundle
The bundle should be automatically registered. Verify in config/bundles.php:
Creating Translatable Entities
Step 1: Create the Main Entity
Step 2: Create the Translation Entity
Usage in Controllers
Repository Examples
Always join translations for better performance:
Form Integration
Translation Form Type
Main Entity Form Type
Customizing Translation Behavior
Override these methods in your translatable entity to customize behavior:
Fallback Priority
The bundle uses this fallback mechanism:
- Exact match - Translation for current locale
- Default locale - Translation for default locale (if
acceptDefaultLocaleTranslationAsDefault()returns true) - First translation - First available translation (if
acceptFirstTranslationAsDefault()returns true) - Handle not found - Calls
handleTranslationNotFound()(throws exception by default)
Testing
Run the test suite:
Run code quality checks:
Run static analysis:
Changelog
Please see CHANGELOG for more information on recent changes.
License
The MIT License (MIT). Please see License File for more information.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Credits
- Jan Rogozinsky
- All Contributors
All versions of translatable-entity-bundle with dependencies
symfony/config Version ^6.4|^7.0
symfony/dependency-injection Version ^6.4|^7.0
symfony/framework-bundle Version ^6.4|^7.0
doctrine/orm Version ^2.19|^3.0