laravel-api-language maintained by lambdadigamma
Description
A simple package for making a Laravel API language header aware.
Author
Last update
2026/03/19 17:54
(dev-main)
License
Downloads
598
Tags
A simple package for making a Laravel API language header aware.
Installation
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
];
Usage
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,
]
];
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.