chinleung/laravel-locales
Add multi-locale support to Laravel with simple config and helper functions. Define supported locales via app.locales or a published config, and use locale() to get/set the current locale and locales() to get/set supported locales.
Architecture fit:
The package aligns well with Laravel’s native localization patterns, offering a lightweight solution for managing locales via config-driven helpers (locale(), locales()). Its compatibility with Laravel 13 ensures alignment with modern Laravel architectures, though the minimal community engagement (36 stars) raises concerns about long-term maintainability. The package’s focus on URL/route localization (e.g., /en/blog) and locale switching fits projects requiring basic-to-intermediate multilingual support, but lacks depth for advanced use cases (e.g., per-field translations, RTL/LTR). The MIT license and lack of dependents suggest low adoption risk for other packages, reducing integration conflicts.
Integration feasibility: Low-to-moderate risk for Laravel 13 projects, assuming:
App::setLocale()) is centralized via the package’s config.Technical risk: High due to:
/fr/blog → /en/blog)?['en' => 'English']) for UI labels?Stack fit: Fully compatible with Laravel 13’s:
locale middleware for session persistence).locales.php).
Unverified for:Migration path:
composer require chinleung/laravel-locales:^3.0
php artisan vendor:publish --provider="ChinLeung\LaravelLocales\LaravelLocalesServiceProvider" --tag="config"
config/app.php:
'locales' => ['en', 'fr', 'es'],
app()->setLocale() with locale('fr').Route::middleware('locale'))./xx/blog → /en/blog).hreflang).Compatibility:
spatie/laravel-translatable).$request->locale.app.php and middleware.Maintenance:
Support:
Scaling:
hreflang).Ramp-up:
How can I help you explore Laravel packages today?