PHPackages                             nerv-oss/accept-language-middleware - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Localization &amp; i18n](/categories/localization)
4. /
5. nerv-oss/accept-language-middleware

ActiveLibrary[Localization &amp; i18n](/categories/localization)

nerv-oss/accept-language-middleware
===================================

Laravel middleware, using the Accept-Language header for locale detection

0.2.0(1y ago)09MITPHPPHP ^8.0.2

Since Sep 2Pushed 1y agoCompare

[ Source](https://github.com/nerv-oss/accept-language-middleware)[ Packagist](https://packagist.org/packages/nerv-oss/accept-language-middleware)[ Docs](https://github.com/nervde/accept-language-middleware)[ GitHub Sponsors](https://github.com/orkhanahmadov)[ RSS](/packages/nerv-oss-accept-language-middleware/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (5)Versions (3)Used By (0)

Laravel "Accept-Language" middleware
====================================

[](#laravel-accept-language-middleware)

[![Latest Stable Version](https://camo.githubusercontent.com/4e8ae79e9fc902f0d900dd1fb857fd5351bcf48405c0365af826a655d97052a7/68747470733a2f2f706f7365722e707567782e6f72672f6f726b68616e61686d61646f762f6c61726176656c2d6163636570742d6c616e67756167652d6d6964646c65776172652f762f737461626c65)](https://packagist.org/packages/orkhanahmadov/laravel-accept-language-middleware)[![Latest Unstable Version](https://camo.githubusercontent.com/c334d3175fa323723db2fac262f51c7b15586f6bc5426fc040ea6c451932f4ce/68747470733a2f2f706f7365722e707567782e6f72672f6f726b68616e61686d61646f762f6c61726176656c2d6163636570742d6c616e67756167652d6d6964646c65776172652f762f756e737461626c65)](https://packagist.org/packages/orkhanahmadov/laravel-accept-language-middleware)[![Total Downloads](https://camo.githubusercontent.com/ee98ce4585d2bd596a68b83135ceb254ef1e8deef6b8f9df16d3c40c428e2514/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6f726b68616e61686d61646f762f6c61726176656c2d6163636570742d6c616e67756167652d6d6964646c6577617265)](https://packagist.org/packages/orkhanahmadov/laravel-accept-language-middleware)[![GitHub license](https://camo.githubusercontent.com/e26dcdfdd797555d59d2c25f8795302f969b33231b95e1d612d54e3fa34158fc/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6f726b68616e61686d61646f762f6c61726176656c2d6163636570742d6c616e67756167652d6d6964646c65776172652e737667)](https://github.com/orkhanahmadov/laravel-accept-language-middleware/blob/master/LICENSE.md)

[![Build Status](https://camo.githubusercontent.com/9efa5711a0323d2639774dc82b363e01256c38a08b4e82671d96d8de9fb89caf/68747470733a2f2f7472617669732d63692e6f72672f6f726b68616e61686d61646f762f6c61726176656c2d6163636570742d6c616e67756167652d6d6964646c65776172652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/orkhanahmadov/laravel-accept-language-middleware)[![Test Coverage](https://camo.githubusercontent.com/c94417532153b75acbeb7c8b65d52f0407db3785ccd9e7843e5770ff096385a8/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f35366264313663396437656234363232363164332f746573745f636f766572616765)](https://codeclimate.com/github/orkhanahmadov/laravel-accept-language-middleware/test_coverage)[![Maintainability](https://camo.githubusercontent.com/16537fc01dd81bbae605871360f054e174499fd189992daf68c0b49476ecbb64/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f35366264313663396437656234363232363164332f6d61696e7461696e6162696c697479)](https://codeclimate.com/github/orkhanahmadov/laravel-accept-language-middleware/maintainability)[![Quality Score](https://camo.githubusercontent.com/8435eeb23838a27993f3b9f3295ea8136d7cd3ec014cd449f2f4efb5901a0017/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f6f726b68616e61686d61646f762f6c61726176656c2d6163636570742d6c616e67756167652d6d6964646c65776172652e737667)](https://scrutinizer-ci.com/g/orkhanahmadov/laravel-accept-language-middleware)[![StyleCI](https://camo.githubusercontent.com/a332881db269f5311d02459a79a847e2def4e950b0555c331e6e3dd36e9b5a6f/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3232373638343636372f736869656c643f6272616e63683d6d6173746572)](https://github.styleci.io/repos/227684667)

Laravel middleware for automatically setting application locale based on [HTTP "Accept-Language"](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language) header

Requirements
------------

[](#requirements)

- PHP **8.0** or higher.
- Laravel **^8.0**, **^9.0** or higher

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require orkhanahmadov/laravel-accept-language-middleware
```

Usage
-----

[](#usage)

Register `\Orkhanahmadov\LaravelAcceptLanguageMiddleware\Middleware::class` middleware in application's HTTP Kernel.

You can install it as global middleware in Kernel's `$middleware` property:

```
protected $middleware = [
    ...
    \Orkhanahmadov\LaravelAcceptLanguageMiddleware\Middleware::class
];
```

You can install it to specific middleware groups in Kernel's `$middlewareGroups` property:

```
protected $middlewareGroups = [
    'web' => [
        ...
        \Orkhanahmadov\LaravelAcceptLanguageMiddleware\Middleware::class
    ]
];
```

Or you can install is as route middleware in Kernel's `$routeMiddleware` and use it manually in routes:

Kernel:

```
protected $routeMiddleware = [
    ...
    'accept-language' => \Orkhanahmadov\LaravelAcceptLanguageMiddleware\Middleware::class
];
```

Route file

```
Route::middleware(['accept-language'])->get('/', 'MyController@index');
```

### Testing

[](#testing)

```
composer test
```

### Changelog

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

### Security

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Orkhan Ahmadov](https://github.com/orkhanahmadov)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance35

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity35

Early-stage or recently created project

 Bus Factor1

Top contributor holds 66.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

621d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/95102310cc1179c1935b0234febd5b94713ae3b742b9f607aaeb5400d2ce1c5e?d=identicon)[nerv](/maintainers/nerv)

---

Top Contributors

[![orkhanahmadov](https://avatars.githubusercontent.com/u/7041590?v=4)](https://github.com/orkhanahmadov "orkhanahmadov (32 commits)")[![thekonz](https://avatars.githubusercontent.com/u/2700089?v=4)](https://github.com/thekonz "thekonz (6 commits)")[![veneliniliev](https://avatars.githubusercontent.com/u/5311085?v=4)](https://github.com/veneliniliev "veneliniliev (6 commits)")[![laravel-shift](https://avatars.githubusercontent.com/u/15991828?v=4)](https://github.com/laravel-shift "laravel-shift (3 commits)")[![gerardnll](https://avatars.githubusercontent.com/u/2018022?v=4)](https://github.com/gerardnll "gerardnll (1 commits)")

---

Tags

laravellocalizationlocalesaccept-languagelaravel middleware

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/nerv-oss-accept-language-middleware/health.svg)

```
[![Health](https://phpackages.com/badges/nerv-oss-accept-language-middleware/health.svg)](https://phpackages.com/packages/nerv-oss-accept-language-middleware)
```

###  Alternatives

[outhebox/laravel-translations

Manage your Laravel translations with a beautiful UI. Add, edit, delete, import, and export translations with ease.

80687.6k](/packages/outhebox-laravel-translations)[orkhanahmadov/laravel-accept-language-middleware

Laravel middleware for setting application locale based on HTTP Accept-Language header

1674.1k1](/packages/orkhanahmadov-laravel-accept-language-middleware)[laravelista/loki

Laravel localization done right.

7816.6k](/packages/laravelista-loki)[longman/laravel-multilang

Package to integrate multi language (multi locale) functionality in Laravel 5.x

5514.4k1](/packages/longman-laravel-multilang)[kerigard/laravel-lang-ru

Ru lang for Laravel

2116.8k](/packages/kerigard-laravel-lang-ru)[sertxudeveloper/laravel-translatable

Manage localized routes and use translatable models in a Laravel app.

183.6k](/packages/sertxudeveloper-laravel-translatable)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
