PHPackages                             mputkowski/laravel-localization - 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. [Framework](/categories/framework)
4. /
5. mputkowski/laravel-localization

ActiveLibrary[Framework](/categories/framework)

mputkowski/laravel-localization
===============================

Powerful Localization for Laravel

v5.2(10mo ago)130MITPHPPHP ^8.0.2CI failing

Since Jan 26Pushed 10mo ago1 watchersCompare

[ Source](https://github.com/mputkowski/Laravel-Localization)[ Packagist](https://packagist.org/packages/mputkowski/laravel-localization)[ RSS](/packages/mputkowski-laravel-localization/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (10)Dependencies (4)Versions (28)Used By (0)

Laravel Localization
====================

[](#laravel-localization)

[![run-tests](https://github.com/mputkowski/Laravel-Localization/actions/workflows/tests.yml/badge.svg?branch=master)](https://github.com/mputkowski/Laravel-Localization/actions/workflows/tests.yml)[![StyleCI](https://camo.githubusercontent.com/265e038ab32a5ece35c374023f960a921cd1265e4c1f0d3327d5f6c7b4e530f2/68747470733a2f2f7374796c6563692e696f2f7265706f732f3131383936363037362f736869656c64)](https://styleci.io/repos/118966076)[![Codecov](https://camo.githubusercontent.com/100f3c1abcd071da28ab29436d15473bd942458ee4cb0d79b4708aefe413cb42/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f6d7075746b6f77736b692f4c61726176656c2d4c6f63616c697a6174696f6e2e7376673f7374796c653d666c61742d737175617265)](https://codecov.io/gh/mputkowski/Laravel-Localization)[![Latest Stable Version](https://camo.githubusercontent.com/78f49bbf67c031d8044bf1ac594f84620bc4b5406d4251782391dba22945b108/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d7075746b6f77736b692f4c61726176656c2d4c6f63616c697a6174696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mputkowski/Laravel-Localization)[![Total Downloads](https://camo.githubusercontent.com/69211feafcaf1ad1873866ff5889d7b3b301684943e2db09d5d4b2c997af9ab8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d7075746b6f77736b692f4c61726176656c2d4c6f63616c697a6174696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mputkowski/Laravel-Localization)[![License](https://camo.githubusercontent.com/82ddfa832433d50e47a2847ea409e72aca9bc6d79f26da5323678c0090ce1a8c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6d7075746b6f77736b692f4c61726176656c2d4c6f63616c697a6174696f6e2e7376673f7374796c653d666c61742d737175617265)](https://github.com/mputkowski/Laravel-Localization/blob/master/LICENSE)

Localization for Laravel

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

[](#installation)

L6L7L8L9L10L11L12v4✓✓✓✓✗✗✗v5✗✗✗✓✓✓✓Add package to composer.json

```
composer require mputkowski/laravel-localization

```

Publish package's config file

```
php artisan vendor:publish --provider="mputkowski\Localization\ServiceProvider"

```

### Laravel 11 or newer

[](#laravel-11-or-newer)

Append the middleware to the `web` group in the `bootstrap/app.php`:

```
->withMiddleware(function (Middleware $middleware) {
    $middleware->web(append: [
        \mputkowski\Localization\Middleware\VerifyLangCookie::class,
    ]);
})
```

### Laravel 10 or older

[](#laravel-10-or-older)

Include middleware within the `web` group in `middlewareGroups` array (`app/Http/Kernel.php`):

```
'web' => [
    \mputkowski\Localization\Middleware\VerifyLangCookie::class,
],
```

**You don't have to register service provider and alias, this package uses Package Auto-Discovery.**

Configuration
-------------

[](#configuration)

Configuration is stored in `config/localization.php` file.

KeyTypeDefaultautobooltruecookie\_namestring`lang`default\_localestring`en`**Route**enabledbooltruepatternstring`/lang/{lang}`### Auto-detection

[](#auto-detection)

If `auto` is set to `true`, the app will automatically detect client's language. The lang directory will be compared with the client's `Accept-Language` header. If header doesn't match with the app's locales, language will be set to default.

Auto-detected language could be changed by accessing a special route designed for that, or by calling the `setLocale` method:

```
use mputkowski\Localization\Facades\Localization;

Localization::setLocale('en');
```

### Route

[](#route)

This package also provides routes for quick language change (url: `/lang/{lang}`, example `/lang/en`).

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

[](#contributing)

Feel free to create pull requests or open issues, I'll look on them as quick as I can.

License
-------

[](#license)

This project is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT).

```
MIT License

Copyright (c) 2018 - 2025 Michał Putkowski

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

```

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance55

Moderate activity, may be stable

Popularity9

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity78

Established project with proven stability

 Bus Factor1

Top contributor holds 99.5% 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 ~105 days

Recently: every ~307 days

Total

27

Last Release

300d ago

Major Versions

v0.5 → v1.02018-03-11

v1.5.1 → v2.02018-08-30

v2.1.1 → v3.02019-11-02

v3.2 → v4.02022-03-06

v4.0.1 → v5.02023-03-11

PHP version history (4 changes)v0.1PHP ^7.0

v1.5PHP ^7.1.3

v4.0PHP ^7.2.5|^8.0

v5.0PHP ^8.0.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/ca06829e2adbec8d5e3ced115e884cefea41e7b09d381e65117540e976019a7f?d=identicon)[mputkowski](/maintainers/mputkowski)

---

Top Contributors

[![mputkowski](https://avatars.githubusercontent.com/u/16721200?v=4)](https://github.com/mputkowski "mputkowski (196 commits)")[![StyleCIBot](https://avatars.githubusercontent.com/u/11048387?v=4)](https://github.com/StyleCIBot "StyleCIBot (1 commits)")

---

Tags

languagelaravellaravel-frameworklaravel-localizationlaravel-packagelaravel-packageslocalizationphpframeworklaravellocalizationlocalelaravel localizationlaravel-locale

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/mputkowski-laravel-localization/health.svg)

```
[![Health](https://phpackages.com/badges/mputkowski-laravel-localization/health.svg)](https://phpackages.com/packages/mputkowski-laravel-localization)
```

###  Alternatives

[laravel-lang/publisher

Localization publisher for your Laravel application

2167.7M24](/packages/laravel-lang-publisher)[laravel/passport

Laravel Passport provides OAuth2 server support to Laravel.

3.4k85.0M532](/packages/laravel-passport)[rebing/graphql-laravel

Laravel wrapper for PHP GraphQL

2.2k7.1M26](/packages/rebing-graphql-laravel)[graham-campbell/markdown

Markdown Is A CommonMark Wrapper For Laravel

1.3k7.1M64](/packages/graham-campbell-markdown)[laravel-lang/common

Easily connect the necessary language packs to the application

1463.1M22](/packages/laravel-lang-common)[graham-campbell/manager

Manager Provides Some Manager Functionality For Laravel

39221.1M134](/packages/graham-campbell-manager)

PHPackages © 2026

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