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

v4.1.1(6y ago)0646MITPHPPHP &gt;=7.2CI failing

Since Oct 28Pushed 1y 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 3w ago

READMEChangelog (7)Dependencies (4)Versions (10)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

32

—

LowBetter than 69% of packages

Maintenance29

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 97.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 ~180 days

Recently: every ~276 days

Total

8

Last Release

2264d 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

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 (1 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.1M337](/packages/psalm-plugin-laravel)[illuminate/database

The Illuminate Database package.

2.8k54.1M11.1k](/packages/illuminate-database)[unisharp/laravel-filemanager

A file upload/editor intended for use with Laravel 5 to 10 and CKEditor / TinyMCE

2.1k3.4M81](/packages/unisharp-laravel-filemanager)[laravel/ai

The official AI SDK for Laravel.

9782.1M162](/packages/laravel-ai)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9742.3M121](/packages/roots-acorn)[api-platform/laravel

API Platform support for Laravel

59156.3k11](/packages/api-platform-laravel)

PHPackages © 2026

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