shureban/laravel-localization
Laravel middleware that auto-sets the application locale from the HTTP Accept-Language header. Install via Composer, register the service provider, and add the Localization middleware globally, per group, or per route.
Accept-Language headers. Lowers technical debt compared to custom solutions.Accept-Language: en-US, es-MX)./en/about or /es/contacto without custom routing logic.en if zh-Hant translations are missing)./:locale/...) for SEO and user experience.Adopt If:
?locale=es query params).Accept-Language headers are reliable (e.g., web apps, not mobile apps with forced locales).Look Elsewhere If:
spatie/laravel-translatable or laravel-localization (note: different package).Accept-Language headers are unreliable (e.g., iOS/Android may ignore them). Use platform-specific APIs instead.*"This package lets us ship multilingual support in weeks, not months, by automating locale detection from user browsers. For example:
/es/blog).ROI:
*"This is a Laravel middleware package that sets the app’s locale dynamically based on the HTTP Accept-Language header. Key benefits:
app/Http/Kernel.php to enable automatic locale detection.How We’ll Use It:
?locale=es params with automatic detection for all web routes./:locale/...) for SEO.Risks:
Next Steps:
composer require shureban/laravel-localization.php artisan vendor:publish --provider="Shureban\LaravelLocalization\LocalizationServiceProvider".Accept-Language headers in Postman/cURL.How can I help you explore Laravel packages today?