PHPackages                             itstructure/laravel-multilingual-tools - 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. itstructure/laravel-multilingual-tools

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

itstructure/laravel-multilingual-tools
======================================

Laravel package for multilingual content manage

2.0.6(1y ago)1280MITPHPPHP &gt;=7.3.0

Since Sep 2Pushed 1y ago1 watchersCompare

[ Source](https://github.com/itstructure/laravel-multilingual-tools)[ Packagist](https://packagist.org/packages/itstructure/laravel-multilingual-tools)[ RSS](/packages/itstructure-laravel-multilingual-tools/feed)WikiDiscussions master Synced yesterday

READMEChangelog (9)Dependencies (1)Versions (12)Used By (0)

MULT
====

[](#mult)

Laravel multilingual tools
--------------------------

[](#laravel-multilingual-tools)

[![Latest Stable Version](https://camo.githubusercontent.com/d4f5583764a150cea5ea726b4d75f376baab3b4a5ecadc566648cb0f0970a4b9/68747470733a2f2f706f7365722e707567782e6f72672f69747374727563747572652f6c61726176656c2d6d756c74696c696e6775616c2d746f6f6c732f762f737461626c65)](https://packagist.org/packages/itstructure/laravel-multilingual-tools)[![Latest Unstable Version](https://camo.githubusercontent.com/8d5de11a329482af78e87bc31f411a1def4f468a30d3da31b15e1ae1090138f9/68747470733a2f2f706f7365722e707567782e6f72672f69747374727563747572652f6c61726176656c2d6d756c74696c696e6775616c2d746f6f6c732f762f756e737461626c65)](https://packagist.org/packages/itstructure/laravel-multilingual-tools)[![License](https://camo.githubusercontent.com/fb3c40691d1876c3df34f0be08a09a0820af7652101c947a0007e323cb58d351/68747470733a2f2f706f7365722e707567782e6f72672f69747374727563747572652f6c61726176656c2d6d756c74696c696e6775616c2d746f6f6c732f6c6963656e7365)](https://packagist.org/packages/itstructure/laravel-multilingual-tools)[![Total Downloads](https://camo.githubusercontent.com/92e9227b5d6658cb967369096a982f5c67d600271c0421f898b244f98bd14aa2/68747470733a2f2f706f7365722e707567782e6f72672f69747374727563747572652f6c61726176656c2d6d756c74696c696e6775616c2d746f6f6c732f646f776e6c6f616473)](https://packagist.org/packages/itstructure/laravel-multilingual-tools)[![Build Status](https://camo.githubusercontent.com/5f5dbdc2a1fdd258932d45764c2ecac57c492cdff57140d5f51f2499c494aaf0/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f69747374727563747572652f6c61726176656c2d6d756c74696c696e6775616c2d746f6f6c732f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/itstructure/laravel-multilingual-tools/build-status/master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/687ab2b774b134388cc4d5cdb5cf879115ad1059e7e277cc14ce0212f6cc0f16/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f69747374727563747572652f6c61726176656c2d6d756c74696c696e6775616c2d746f6f6c732f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/itstructure/laravel-multilingual-tools/?branch=master)

[![MULT package label](https://github.com/itstructure/laravel-multilingual-tools/raw/master/mult.png)](https://github.com/itstructure/laravel-multilingual-tools/blob/master/mult.png)

1 Introduction
--------------

[](#1-introduction)

**MULT** - Package for the Laravel framework to content manage with different languages.

For example, you can store pages in English, Russian, French, German and some another languages...

It is you who add new languages to your application.

All multilingual fields will be with a language postfix, as in example:

`title_en`, `description_en`, `content_en`

`title_ru`, `description_ru`, `content_ru`, e t. c.

2 Dependencies
--------------

[](#2-dependencies)

- laravel 8+ | 9+ | 10+ | 11+ | 12+
- php &gt;= 7.3
- composer

3 Installation
--------------

[](#3-installation)

**Note!**

Version **2.x** is for laravel **8**, **9**, **10**, **11**, **12**.

Version **1.x** is for laravel **7**. You can use branch `laravel7-mult` with **1.x** versions.

### 3.1 General installation from remote repository

[](#31-general-installation-from-remote-repository)

Run the composer command:

`composer require itstructure/laravel-multilingual-tools "~2.0.6"`

### 3.2 If you are testing this package from local server directory

[](#32-if-you-are-testing-this-package-from-local-server-directory)

In application `composer.json` file set the repository, as in example:

```
"repositories": [
    {
        "type": "path",
        "url": "../laravel-multilingual-tools"
    }
],
```

Here,

**../laravel-multilingual-tools** - directory name, which has the same directory level as your project application and contains MULT package.

Then run command:

`composer require itstructure/laravel-multilingual-tools:dev-master --prefer-source`

### 3.3 Next internal installation steps

[](#33-next-internal-installation-steps)

1. Publish files.

    - To publish migrations run command:

        `php artisan mult:publish --only=migrations`

        It stores migration file to `database/migrations` folder. There is a migration to create **languages** table.
    - To publish seeder run command:

        `php artisan mult:publish --only=seeders`

        It stores seeder files to `database/seeders` folder. There is a seeder to create a first **English** language DB entry as a default.
    - To publish all parts run command without `only` argument:

        `php artisan mult:publish`

    Else you can use `--force` argument to rewrite already published files.
2. Run command to run migration and seed:

    `php artisan mult:database`

    The next will be acted:

    - A table **languages** will be created.
    - A first **English** language will be stored as a default.

    Or optional:

    To run just migration `php artisan mult:database --only=migrate`

    To run just seed `php artisan mult:database --only=seed`

    - Alternative variant for seeders.

        You can set published `MultSeeder` seeder class in to a special `DatabaseSeeder`:

        ```
        use Illuminate\Database\Seeder;
        ```

        ```
        class DatabaseSeeder extends Seeder
        {
            public function run()
            {
                $this->call(MultSeeder::class);
            }
        }
        ```

        and run command: `php artisan db:seed`.

4 Usage
-------

[](#4-usage)

**Notes**:

- There are no controllers, views, routes and another CRUD elements to manage languages. There is just a model `Language`. This CRUD you must to create by yourself in your application.
- There are no controllers, models, views, routes and another CRUD elements to manage entity content. There are just base classes, which are written below. CRUDs you must to create by yourself in your application.

### 4.1 Migration part

[](#41-migration-part)

First, before a develop multilingual application, make migrations with extending from `MultilingualMigration` base class.

Example for **pages** table:

```
use Illuminate\Database\Schema\Blueprint;
use Itstructure\Mult\Classes\MultilingualMigration;
```

```
class CreatePagesTable extends MultilingualMigration
{
    public function up()
    {
        $this->createMultilingualTable('pages', function (Blueprint $table) {
            $table->string('title', 64);
            $table->text('description')->nullable();

        }, function (Blueprint $table) {
            $table->unsignedTinyInteger('active')->default(0)->index();
            $table->string('alias', 64)->index();
        });
    }

    public function down()
    {
        $this->dropMultilingualTable('pages');
    }
}
```

Here,

**createMultilingualTable()** method provides:

1. First argument: table name.
2. Second argument: a callable with multilingual fields.
3. Third argument: a callable with simple fields.

After applying a migration, two tables will be created automatically:

- **pages** - to store a simple data.
- **pages\_languages** - to store translates, some entries for concrete **pages** entry.

**Note:** Timestamps created automatically for both tables.

And the next special columns for **pages\_languages** table with foreign keys will be created automatically:

- column **pages\_id**. Foreign key to **pages** table `pages_languages(pages_id) -> pages(id)`
- column **languages\_id**. Foreign key to **languages** table `pages_languages(languages_id) -> languages(id)`

Example with already stored data:

`Main table "pages"`

```
| id | active |    alias    |      created_at     |      updated_at     |
|----|--------|-------------|---------------------|---------------------|
| 1  |    1   | first-page  | 2020-01-14 18:06:33 | 2020-01-14 18:06:33 |
| 2  |    1   | second-page | 2020-01-14 18:10:00 | 2020-01-14 18:10:00 |
| 3  |    0   | third-page  | 2020-01-14 19:05:15 | 2020-01-14 19:05:15 |

```

`Translate table "pages_languages"`

```
| pages_id | languages_id |    title   |      description     |      created_at     |      updated_at     |
|----------|--------------|------------|----------------------|---------------------|---------------------|
|    1     |      1       | Page 1     |     Description 1    | 2020-01-14 18:06:33 | 2020-01-14 18:06:33 |
|    1     |      2       | Страница 1 |     Описание 1       | 2020-01-14 18:06:33 | 2020-01-14 18:06:33 |
|    2     |      1       | Page 2     |     Description 2    | 2020-01-14 18:10:00 | 2020-01-14 18:10:00 |
|    3     |      1       | Page 3     |     Description 3    | 2020-01-14 19:05:15 | 2020-01-14 19:05:15 |
|    3     |      2       | Страница 3 |     Описание 3       | 2020-01-14 19:05:15 | 2020-01-14 19:05:15 |

```

`Language table "languages"`

```
| id | locale | short_name |  name   | default |      created_at     |      updated_at     |
|----|--------|------------|---------|---------|---------------------|---------------------|
| 1  | en-US  |     en     | English |    1    | 2020-01-14 18:06:33 | 2020-01-14 18:06:33 |
| 2  | ru-RU  |     ru     | Русский |    0    | 2020-01-14 18:10:00 | 2020-01-14 18:10:00 |

```

### 4.2 Model part

[](#42-model-part)

**Notes:**

- Access to multilingual value from a model entry is by using a language postfix. Example:

    ```
    $model = Page::findOrFail($id);
    echo $model->title_en;
    ```
- Set a new multilingual value for a model is by using a language postfix. Example:

    ```
    $model = Page::findOrFail($id);
    $model->title_en = 'New title value';
    $model->save();
    ```

#### 4.2.1 Main simple model

[](#421-main-simple-model)

Create a main model for base table and use `MultilingualModelTrait`.

Example model for **pages** table:

```
namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Itstructure\Mult\Traits\MultilingualModelTrait;
```

```
class Page extends Model
{
    use MultilingualModelTrait;

    protected $table = 'pages';

    protected $fillable = ['active', 'alias'];
}
```

#### 4.2.2 Translate model

[](#422-translate-model)

Create a model for translates table.

Example model for **pages\_languages** table:

```
namespace App\Models;

use Illuminate\Database\Eloquent\Model;
```

```
class PageLanguage extends Model
{
    protected $table = 'pages_languages';

    protected $fillable = ['pages_id', 'languages_id', 'title', 'description'];

    public function page() // It is not necessary to create
    {
        return $this->hasOne(Page::class, 'id', 'pages_id');
    }

    public function language() // It is not necessary to create
    {
        return $this->hasOne(Language::class, 'id', 'languages_id');
    }
}
```

It is not necessary to create relation methods here, such as: `page()`, `language()`. It is additional.

### 4.3 Validation requests part

[](#43-validation-requests-part)

This request classes can be useful in controller's methods.

```
namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;
use Itstructure\Mult\Models\Language;
use Itstructure\Mult\Helpers\MultilingualHelper;
```

```
class StorePageRequest extends FormRequest
{
    protected $shortLanguageList = [];

    public function __construct()
    {
        parent::__construct();

        $this->shortLanguageList = Language::shortLanguageList();
    }

    public function authorize()
    {
        return true;
    }

    public function rules()
    {
        $multilingualRules = MultilingualHelper::fieldsTransformer([
            'title' => 'required|string|min:3|max:64',
            'description' => 'nullable|string'

        ], function ($fieldValue) {
            return $fieldValue;

        }, $this->shortLanguageList);

        return array_merge([
            'active' => 'required|numeric',
            'alias' => 'required|string|min:3|max:64'

        ], $multilingualRules);
    }

    public function attributes()
    {
        $multilingualAttributes = MultilingualHelper::fieldsTransformer([
            'title' => __('messages.title'),
            'description' => __('messages.description')

        ], function ($fieldValue) {
            return $fieldValue;

        }, $this->shortLanguageList);

        return array_merge([
            'active' => __('messages.activity'),
            'alias' => __('messages.alias')

        ], $multilingualAttributes);
    }
}
```

Here `roles()` method makes the next result:

```
[
    "active" => "required|numeric",
    "alias" => "required|string|min:3|max:64",
    "title_en" => "required|string|min:3|max:64",
    "title_ru" => "required|string|min:3|max:64",
    "description_en" => "nullable|string",
    "description_ru" => "nullable|string"
]
```

### 4.4 Controller part

[](#44-controller-part)

Short page controller example just to create entry:

```
namespace App\Http\Controllers;

use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller;
use Itstructure\Mult\Models\Language;
use Itstructure\Mult\Helpers\MultilingualHelper;
use App\Models\Page;
use App\Http\Requests\StorePageRequest;
```

```
class PageController extends Controller
{
    use AuthorizesRequests, DispatchesJobs, ValidatesRequests;

    public function create()
    {
        $languageList = Language::languageList();

        return view('page.create', compact('languageList'));
    }

    public function store(StorePageRequest $request)
    {
        MultilingualHelper::fill(new Page(), $request->all())->save();

        return redirect()->route('page_list');
    }
}
```

### 4.5 View template part

[](#45-view-template-part)

Short example for `page.create` blade view template:

```

        @foreach($languageList as $langModel)

                    {{ $langModel->name }}

        @endforeach

        @foreach($languageList as $langModel)

                            {!! __('messages.title') !!}

                            @if ($errors->has('title_'.$langModel->short_name))

                                    {{ $errors->first('title_'.$langModel->short_name) }}

                            @endif

                            {!! __('messages.description') !!}

                            @if ($errors->has('description_'.$langModel->short_name))

                                    {{ $errors->first('description_'.$langModel->short_name) }}

                            @endif

        @endforeach

                active : 1) == 1) checked @endif >
                {!! __('messages.active') !!}

                active : 1) == 0) checked @endif >
                {!! __('messages.inactive') !!}

    Create

```

License
-------

[](#license)

Copyright © 2020-2025 Andrey Girnik .

Licensed under the [MIT license](http://opensource.org/licenses/MIT). See LICENSE.txt for details.

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance44

Moderate activity, may be stable

Popularity13

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~182 days

Recently: every ~352 days

Total

10

Last Release

436d ago

Major Versions

1.0.2 → 2.0.02020-09-09

PHP version history (2 changes)1.0.0PHP &gt;=7.2.5

2.0.0PHP &gt;=7.3.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/31563329?v=4)[Andrey Girnik](/maintainers/itstructure)[@itstructure](https://github.com/itstructure)

---

Top Contributors

[![itstructure](https://avatars.githubusercontent.com/u/31563329?v=4)](https://github.com/itstructure "itstructure (10 commits)")

---

Tags

laravellanguagemultilingual

### Embed Badge

![Health badge](/badges/itstructure-laravel-multilingual-tools/health.svg)

```
[![Health](https://phpackages.com/badges/itstructure-laravel-multilingual-tools/health.svg)](https://phpackages.com/packages/itstructure-laravel-multilingual-tools)
```

###  Alternatives

[typicms/base

A modular multilingual CMS built with Laravel, enabling developers to manage structured content like pages, news, events, and more.

1.6k20.3k](/packages/typicms-base)[josiasmontag/laravel-redis-mock

This Laravel package provides a Redis mock for your tests

471.8M16](/packages/josiasmontag-laravel-redis-mock)[velstorelabs/velstore

Velstore - A multi-vendor, multi-lingual Laravel eCommerce boilerplate.

6301.3k](/packages/velstorelabs-velstore)[josiasmontag/laravel-localization

Localization for Laravel framework

2336.2k](/packages/josiasmontag-laravel-localization)[glebsky/laravel-lang-generator

Searches for multilingual phrases in Laravel project and automatically generates language files for you.

2421.3k](/packages/glebsky-laravel-lang-generator)[martin-schenk/laravel-cookie-consent

GDPR-compliant cookie consent system with minimal dependencies for Laravel 11 and 12

101.3k](/packages/martin-schenk-laravel-cookie-consent)

PHPackages © 2026

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