PHPackages                             zagovorichev/laravel-languages - 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. zagovorichev/laravel-languages

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

zagovorichev/laravel-languages
==============================

Using different languages in the Laravel

v5.0.0(1mo ago)0715MITPHPCI failing

Since Oct 28Pushed 1mo agoCompare

[ Source](https://github.com/zagovorichev/laravel-languages)[ Packagist](https://packagist.org/packages/zagovorichev/laravel-languages)[ RSS](/packages/zagovorichev-laravel-languages/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (8)Dependencies (8)Versions (11)Used By (0)

Multi language Laravel Plugin
=============================

[](#multi-language-laravel-plugin)

This package pulls in the framework agnostic Language Manager and provides seamless integration with **Laravel 5**.

- [What is it?](#what-is-it?)
- [Installation](#installation)
- [Usage](#usage)
- [Requirements](#requirements)
- [License](#license)

What is it?
-----------

[](#what-is-it)

Language manager: you can choose new language and it will be placed as `App::setLocale($lang)`

Language will be saved in SESSION and/or COOKIE

Also you can use URL

```
http://www.example.com/article/1?lang=en => http://en.example.com/en/article/1

```

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

[](#installation)

`composer require zagovorichev/laravel-languages`

Add to the **app.php** (by default in */laravel/config/app.php*) lines:

```
'providers' => [
    // ...
    Zagovorichev\Laravel\Languages\LanguageServiceProvider::class,
]
```

And new middleware into the **Kernel.php** (look in */laravel/app/Http/Kernel.php*)

```
protected $middlewareGroups = [
        'web' => [
            // ...
            \Zagovorichev\Laravel\Languages\Http\Middleware\LanguagesMiddleware\LanguagesMiddleware::class,
        ],
    ];
```

Usage
-----

[](#usage)

Language manager provides working with sessions, cookies, path and domain.

For changing system language send request with input **lang**. For example: `?lang=es`and in application you will have Spain locale.

All configurations stored in the **languages.php** file.
For making your own configuration copy file */laravel/vendor/zagovorichev/laravel-languages/config/languages.php*to the folder */laravel/config/*.

#### Simple usage (SESSION + COOKIE)

[](#simple-usage-session--cookie)

If you need simple language manager you can use only 'session' and 'cookie' modes. Then you don't need to configure anything more.

#### Domain Map

[](#domain-map)

For using DomainMapManger in your configuration file you should matched languages and domains

```
'domainMap' => [
    'en' => 'www.example.com',
    'es' => 'es.example.com',
    'ua' => 'www.example.ua',
],

```

> ⚠️ **Notice**: Please, use only DomainMap or Domain modes, otherwise the behaviour will be unpredictable.

#### Domain

[](#domain)

Also you can provide regular expression in the configuration file.

```
'domainRegExp' => [
    'reg' => '|^(http://)([a-z]{2})[\.]{0,1}(example\.com.*)$|ui',
    'langPart' => 2,
]
```

And as a result you will have `http://www.example.en/post/234 => http://en.example.com/post/234 => http://es.example.com/post/234`

> ⚠️ **Notice**: Please, use only DomainMap or Domain modes, otherwise the behaviour will be unpredictable.

#### Path

[](#path)

Similar to domains, you can provide regular expression:

```
'pathRegExp' => [
     'reg' => '|([a-z]{2})(/.*)|ui',
     'langPart' => 1, // lang part will be replaced with new lang
 ],
```

### Modes of the languages manager

[](#modes-of-the-languages-manager)

Each store has its own manager.

- **session** - store in the $\_SESSION
- **cookie** - store in the browser $\_COOKIES
- **domainMap** - you can define map if you have different domain which can't be described with simple regular expression
- **domain** - use domain name for determining current language ([www.example.com](http://www.example.com), en.example.com, es.example.com...)
- **path** - use uri for language example.com/en/address

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

[](#requirements)

- PHP 5.6
- Laravel 5.3

License
-------

[](#license)

This package is licensed under the [MIT license](https://github.com/backup-manager/laravel/blob/master/LICENSE)

###  Health Score

49

—

FairBetter than 94% of packages

Maintenance91

Actively maintained with recent releases

Popularity15

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor1

Top contributor holds 93.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 ~441 days

Recently: every ~748 days

Total

9

Last Release

43d ago

Major Versions

v1.1.1 → v2.0.02017-04-03

v2.0.0 → v3.0.02018-04-20

v3.0.0 → v4.0.02018-09-13

v4.1.1 → v5.0.02026-06-29

PHP version history (3 changes)v1.0.0PHP &gt;=5.6.4

v3.0.0PHP &gt;=7.1.3

v4.1.1PHP &gt;=7.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1445911?v=4)[Oleksandr Zagovorychev](/maintainers/zagovorichev)[@zagovorichev](https://github.com/zagovorichev)

---

Top Contributors

[![zagovorichev](https://avatars.githubusercontent.com/u/1445911?v=4)](https://github.com/zagovorichev "zagovorichev (43 commits)")[![SashaEasyPark](https://avatars.githubusercontent.com/u/115998239?v=4)](https://github.com/SashaEasyPark "SashaEasyPark (3 commits)")

---

Tags

laravellocalizationtranslatesessioncookiedomain

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/zagovorichev-laravel-languages/health.svg)

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

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3345.4M354](/packages/psalm-plugin-laravel)[api-platform/laravel

API Platform support for Laravel

58190.1k21](/packages/api-platform-laravel)[mike-bronner/laravel-model-caching

Automatic caching for Eloquent models.

2.4k161.4k1](/packages/mike-bronner-laravel-model-caching)[illuminate/database

The Illuminate Database package.

2.8k55.8M12.9k](/packages/illuminate-database)[laravel/ai

The official AI SDK for Laravel.

1.1k4.6M295](/packages/laravel-ai)[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

79227.1M210](/packages/laravel-mcp)

PHPackages © 2026

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