Download the PHP package aristonis/laravel-language-switcher without Composer
On this page you can find all versions of the php package aristonis/laravel-language-switcher. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download aristonis/laravel-language-switcher
More information about aristonis/laravel-language-switcher
Files in aristonis/laravel-language-switcher
Package laravel-language-switcher
Short Description auto detected user language and set it for application with manully option for user to slelect language
License MIT
Informations about the package laravel-language-switcher
Laravel Language Switcher
Auto-detects user language from browser/session and sets it for the Laravel application. Provides manual selection via a form component.
Features
- Automatic language detection (browser, session, custom detectors).
- Session-based persistence.
- User profile integration for authenticated users.
- Blade component for language switcher.
- Configurable supported languages and detectors.
Installation
-
Install via Composer:
-
Publish config file:
-
Register middleware
- Add route in
routes/web.php:
Configuration
In config/language-switcher.php:
supported_languages: Array of supported locales (e.g.,['en' => 'English', 'ar' => 'Arabic']).detectors: Enabled detectors (e.g.,['browser']).session_key: Session key for locale (default:__lang).
Usage
Middleware
Automatically sets app()->setLocale() on each request.
Language Switcher Component
In Blade views:
Detectors
- Browser: Detects from
Accept-Languageheader. - Custom:
- Extends:
LanguageDetectorInterface - add new class on config file with array
detectors
- Extends:
Manual Update
POST to /language-switch with locale field.
Publishing Views
Changelog
Please see CHANGELOG for more information on what has changed recently.
Issues
Report issues at GitHub Issues.
Collaboration
Contributions welcome! Fork the repo, create a feature branch, and submit a pull request. See CONTRIBUTING for details.
Security Vulnerabilities
Email Issues.
License
The MIT License (MIT). Please see License File for more information.
Support
For support, open an issue.