birdsolutions/laravel-language
| Install | |
|---|---|
composer require birdsolutions/laravel-language |
|
| Latest Version: | 1.1 |
| License: | MIT |
| Last Updated: | Mar 15, 2017 |
| Links: | GitHub · Packagist |
Laravel Route Localization Package
This package will help you localize your routes, set the language from the routes and add some nice functionality to it.
Installation
composer require birdsolutions/laravel-language
Service Provider Add the service provider to the config/app.php file
[
/*
* Package Service Providers...
*/
BirdSolutions\Language\Providers\LanguageServiceProvider::class,
]
Facade
'aliases' => [
...
'Language' => BirdSolutions\Language\Facades\Language::class,
]
Config Publish the configuration file.
php artisan vendor:publish --provider="BirdSolutions\Language\Providers\LanguageServiceProvider"
Middleware Add the language Middleware to the routeMiddleware array in kernel.php
protected $routeMiddleware = [
...
'language' => \BirdSolutions\Language\Middleware\LanguageMiddleware::class,
];
Routes
Route::group([
'prefix' => \Language::getLocale(),
'middleware' => 'language'
], function () {
// Add Localized routes here.
});
Change Language Manually
Route::any('/language', '\BirdSolutions\Language\Controllers\LanguageController@changeLanguage');
It will accept an input of language and set the language to the desired, you can send in get or post inputs.
<a href='https://github.com/mahmoud-birdsol/laravel-language/blob/HEAD/language?language=en'>English</a>
Related Packages
Powerful PHP database abstraction layer (DBAL) with many features for database s...
Laravel Serializable Closure provides an easy and secure way to serialize closur...
Cli error handling for console/command-line PHP applications.
Version History
| Version | Released | License |
|---|---|---|
| 1.1 | MIT | |
| 1.0 | MIT |