Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Symfony Bundle

Symfony Bundle Laravel Package

php-translation/symfony-bundle

Symfony bundle for the PHP Translation library. Integrates translation management, storage, and workflows into Symfony apps, with services and console tooling to import/export translations and keep locale files in sync across providers.

View on GitHub
Deep Wiki
Context7

Symfony integration for Translations

Frequently asked questions about Symfony Bundle
Can I use php-translation/symfony-bundle in Laravel without Twig, since I only use Blade?
Yes, the core translation logic (loading, caching, and PHP-based translation) works independently of Twig. The recent twig_callable fix only affects Twig-specific features like filters. For Blade, focus on using the Translator service directly (e.g., `$translator->trans()`) and exclude Twig-related components via custom Composer scripts if needed.
Will this bundle break my existing Laravel translation setup (e.g., Laravel’s __() or blade-translation) if I integrate it?
No, this bundle doesn’t override Laravel’s native translation methods. You can use it alongside Laravel’s `__()` or `blade-translation` for a hybrid approach. The bundle adds advanced features like pluralization, caching, and workflows while leaving your existing setup intact.
Does this bundle support Laravel’s cache drivers (Redis, Memcached) for translation caching?
The bundle uses Symfony’s CacheInterface, which can be configured to work with Laravel’s cache drivers. You’ll need to align the cache pool setup in Symfony’s configuration with Laravel’s cache configuration, but no native Laravel-specific changes are required for basic compatibility.
How do I install this bundle in Laravel without pulling in unnecessary Symfony/Twig dependencies?
Use Composer’s `replace` or `provide` directives in your `composer.json` to exclude Twig if unused. For example, add `'symfony/twig-bridge': '*'` under `replace` to avoid pulling Twig. The core translation features will still work without it.
Is this bundle compatible with Laravel 10+ and Symfony 6+?
Yes, this release maintains compatibility with Symfony 6.x and Laravel 9/10. The dependency updates (e.g., ramsey/composer-install) are minor and don’t affect runtime behavior. Always check the package’s `composer.json` for exact Symfony component versions required.
Can I use this bundle for API-only Laravel apps where Twig is not involved?
Absolutely. The bundle’s translation logic is Twig-agnostic and works perfectly for API-first Laravel apps. Focus on using the `Translator` service for PHP-based translations, and ignore Twig-related features entirely.
How do I configure translation providers (e.g., JSON, YAML, database) in Laravel with this bundle?
Configure providers via Symfony’s `framework.translation` settings in your Laravel config (e.g., `config/packages/php_translation.yaml`). The bundle supports JSON, YAML, and database backends out of the box. Use Laravel’s service provider to merge Symfony’s configuration with your app’s needs.
Are there performance implications for Laravel apps using this bundle compared to native translation methods?
No significant performance impact. The bundle’s translation logic is optimized and caches translations like Laravel’s native system. The only potential overhead comes from Twig dependencies, which you can avoid entirely if not using Twig.
What’s the best way to test this bundle in a Laravel application?
Mock Symfony’s `TranslatorInterface` and `LoaderInterface` in your tests to isolate the bundle’s logic. Use Laravel’s testing tools to verify integration with your app’s translation methods. No additional assertions are needed for this minor release.
Are there alternatives to this bundle for Laravel that avoid Symfony dependencies?
Yes, alternatives like `spatie/laravel-translation-loader` or `laravel-lang/lang` focus on Laravel-native solutions without Symfony. However, this bundle offers advanced features like pluralization, caching, and workflows that may not be available in lighter alternatives.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
nasirkhan/laravel-sharekit
directorytree/privacy-filter-classifier
directorytree/privacy-filter
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
22h/doctrine-garbage-collection-bundle
agtp/agtp-php
agtp/mod-php
splash/sonata-admin
splash/metadata
splash/openapi
splash/scopes
splash/toolkit
testo/output-teamcity
testo/bridge-symfony