madbox-99 / laravel-locale-switcher
Simple locale switcher for Laravel applications using cookies.
Package info
github.com/MadBox-99/laravel-locale-switcher
pkg:composer/madbox-99/laravel-locale-switcher
v1.1.1
2026-05-04 13:11 UTC
Requires
- php: ^8.2
- illuminate/http: ^11.0|^12.0|^13.0
- illuminate/support: ^11.0|^12.0|^13.0
Requires (Dev)
- orchestra/testbench: ^9.0|^10.0|^11.0
- pestphp/pest: ^2.0|^3.0
README
A lightweight Laravel package for switching locales in applications using cookies or URL prefixes.
Features
- Switch locales from routes or middleware
- Support cookie-based locale persistence
- Support URL-prefix-based locale handling
- Blade components for locale dropdowns and hreflang tags
- Easy integration with Laravel applications
Installation
Install via Composer:
composer require madbox-99/laravel-locale-switcher
Publish the package configuration if needed:
php artisan vendor:publish --provider="MadBox\\LocaleSwitcher\\LocaleSwitcherServiceProvider"
Usage
The package provides helpers and middleware to set the current locale, switch between languages, and expose locale-aware routes and views.
Testing
Run the test suite with:
./vendor/bin/pest