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
Lokalise Bundle

Lokalise Bundle Laravel Package

alicorn/lokalise-bundle

View on GitHub
Deep Wiki
Context7

At a glance

Frequently asked questions about Lokalise Bundle
Can I use this bundle directly in Laravel without Symfony?
No, this bundle is Symfony-specific and won’t work natively in Laravel. You’d need to either use a Symfony bridge (e.g., symfony/http-client) or build a custom Laravel service to replicate its functionality. Laravel’s filesystem and routing systems won’t integrate directly with the bundle’s webhook or CLI commands.
How do I handle Laravel’s PHP array translations (resources/lang) with Lokalise’s JSON/PO exports?
You’ll need to pre-process or post-process files to convert between formats. Tools like `laravel-translation-manager` or custom scripts can help convert JSON/PO to Laravel’s PHP array format. The bundle itself only supports JSON/YAML/PO, so manual mapping is required for Laravel’s native structure.
What Laravel versions and PHP versions does this bundle support?
This bundle is designed for Symfony 2.x/3.x and was last updated in 2018. It does not officially support Laravel or PHP 8.x. You’d need to fork and update dependencies (e.g., ext-zip, ext-curl) and Symfony components (like HttpClient) to make it work in modern Laravel or PHP environments.
How do I set up Lokalise webhooks in Laravel instead of Symfony’s annotation routing?
Replace Symfony’s annotation-based routing with Laravel’s `Route::post()` in `routes/web.php`. Create a custom controller (e.g., `LokaliseWebhookController`) to handle the webhook payload, then use Guzzle or Symfony’s HttpClient to process the data and sync files to `storage/app/public/locales` or `resources/lang`.
Is there a way to avoid hardcoded API tokens in config files?
The bundle stores API tokens in `config.yml`, which is insecure. For Laravel, move tokens to `.env` and inject them via Laravel’s service container or a custom service class. You’d need to modify the bundle’s configuration logic or build a wrapper service to fetch tokens from environment variables.
Are there alternatives to this bundle that work better with Laravel?
Yes, consider `crowdin/crowdin-api` or `poeditor/poeditor-api` for Laravel. These packages are more modern, support Laravel’s ecosystem, and avoid Symfony dependencies. For Lokalise specifically, a custom Laravel service using Guzzle or Symfony’s HttpClient would be more maintainable than adapting this bundle.
How do I initialize the AlicornLokaliseBundle in Laravel’s AppServiceProvider?
You can’t directly initialize this bundle in Laravel. Instead, create a custom service provider (e.g., `LokaliseServiceProvider`) that registers a service class handling API calls and file syncs. Use Laravel’s `boot()` method to trigger translations on demand or via events, mimicking the bundle’s functionality without Symfony’s kernel.
What happens if the webhook fails or the API returns errors?
The bundle lacks built-in error handling or retry logic. For Laravel, implement custom logging (e.g., Laravel’s `Log` facade) and retry mechanisms in your webhook controller or service. Consider using Laravel’s `Queue` system to defer failed syncs and notify admins via email or Slack.
Can I use this bundle with Symfony 5/6+ or will it break?
This bundle is incompatible with Symfony 5/6+ due to deprecated components (e.g., `AppKernel`, old DI container). You’d need to fork it and update dependencies like `symfony/http-client`, `symfony/console`, and `symfony/dependency-injection`. Even then, Laravel’s ecosystem (e.g., service providers, routing) won’t align cleanly.
How do I test this bundle in a Laravel environment before full integration?
Start by testing the Lokalise API calls manually using Guzzle or Postman to verify responses. Mock webhook payloads in Laravel’s `tests/Feature` directory and assert file syncs to `storage/app/public/locales`. Use Laravel’s `Http::fake()` to simulate API failures and validate error handling in your custom service.
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.
make-dev/orca
dmstr/symfony-system-resources-bundle
dmstr/symfony-job-queue-bundle
dmstr/openapi-json-schema-bundle
dmstr/keycloak-security-bundle
dmstr/doctrine-audit-log-bundle
dmstr/api-platform-utils-bundle
dmstr/api-configuration-bundle
chrisdev/ux-components
baks-dev/finances
emuniq/filament-browser-notifications
syriable/filament-translator
hungnm28/livewire-form
wenprise/eloquent
crudly/encrypted
fadion/bouncy
cuci/prototurk-sdk
gos/pubsub-router-bundle
cuci/prototurk-sdk-symfony
clementtalleu/easyadmin-markdown-bundle