You can install the package via composer:
composer require lambdadigamma/laravel-api-language
You can publish the config file with:
php artisan vendor:publish --provider="Lambdadigamma\LaravelApiLanguage\LaravelApiLanguageServiceProvider" --tag="api-language-config"
This is the contents of the published config file:
return [
'supported_locales' => ['en'],
'use_autoscan_lang_folder' => false
];
To use the accept language middleware, just register it in your application's HTTP kernel.
Register it as a global middleware:
protected $middleware = [
...
\Lambdadigamma\LaravelApiLanguage\Http\Middleware\AcceptLanguageMiddleware::class,
];
Register in a specific middleware group:
protected $middlewareGroups = [
'api' => [
...
\Lambdadigamma\LaravelApiLanguage\Http\Middleware\AcceptLanguageMiddleware::class,
]
];
composer test
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
Please review our security policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.