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

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

ozanakman/laravel-multilingual
==============================

Simple localization for Laravel apps.

1.0(7y ago)1111[1 issues](https://github.com/OzanAkman/laravel-multilingual/issues)MITPHPPHP ^7.1

Since Oct 29Pushed 5y ago1 watchersCompare

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

READMEChangelog (1)Dependencies (5)Versions (4)Used By (0)

Multilingual Laravel 🌐
======================

[](#multilingual-laravel-globe_with_meridians)

Introduction
------------

[](#introduction)

Multilingual is a localization package for Laravel apps. It has built-in methods to make localization simple. It aims to give you developing speed and not to worry about locales.

This package created by Ozan Akman

- Handling redirects easily (domain or path based)
- Extended router class for localized routes
- Blade directive @forEachLocale
- Highly customizable

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

[](#installation)

You may use Composer to install Multilingual into your Laravel project:

```
composer require ozanakman/laravel-multilingual
```

> **Note:** Multilingual requires Laravel 5.7.0+.

After installing Multilingual, publish its assets using the `multilingual:install` Artisan command. It will migrate `locales` and `translations` tables.

```
php artisan multilingual:install
```

After publishing Multilingual's assets, its primary configuration file will be located at `config/multilingual.php`.

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

[](#configuration)

There are two options in the config file.

`pattern` is used to handle redirects and how should system treat to urls. Pattern can *only* be `domain` or `path`.

when you select `domain` as the pattern. Localized url would be something like this: `en.domain.com` or `tr.domain.com`.

when you select `path` as the pattern. Localized url would be something like this: `domain.com/en` or `domain.com/tr`.

The other option is just for customizing *middleware*. You can either use `OzanAkman\Multilingual\Middleware\Localize` which is handling redirects or create your own.

### Content of the published config file

[](#content-of-the-published-config-file)

```
return [
    /*
     * How we should treat urls to get the selected language?
     * http://{domain}.site.com
     * http://site.com/{path}
     *
     * Supported: "domain", "path"
     */
    'pattern' => 'path',

    /**
     * Localization middleware to handle user redirects.
     */
    'middleware' => OzanAkman\Multilingual\Middleware\Localize::class,
];
```

Localized Routes
----------------

[](#localized-routes)

There is a mixing for localized routes that you can use. `Route::locale` creates localized urls for each locale. In the example below, User will see `welcome` view by visiting `domain.com/en/home` or `domain.com/tr/home`

```
Route::locale(function () {
    Route::get('/home', function () {
        return view('welcome');
    });
});
```

You may also add attributes to `Route::locale` as same as `Route::group` method

```
Route::locale(['middleware' => 'auth'], function () {
    Route::get('/invoice/{invoiceId}', 'InvoiceController@show');
});
```

After all, it's just a shortcut.

Blade Directive
---------------

[](#blade-directive)

You can easily handle locale based components like locale selection dropdown or multilingual content editor, etc..

You can use this directive as much as you want. Locales are cached behind scenes. So, no need to worry.

```
@forEachLocale($item)
{{ $item->code }}
{{ $item->name }}
{{ $item->native_name }}
{{ $item->enabled }}
{{ $item->default }}
@endForEachLocale
```

Models
------

[](#models)

`Locale` and `Translation` model files available under `OzanAkman\Multilingual\Models` namespace.

Locales
=======

[](#locales)

- You can add a new locale by calling `Artisan` command:

```
php artisan multilingual:add {code} {name} {native name}
```

```
php artisan multilingual:add tr Turkish Türkçe
```

- Removing a language

```
php artisan multilingual:remove tr
```

> Be careful, this command will delete all translations that belongs to the locale.

**Manually,** you can use Locale model to add/edit/remove a locale.

Translations
------------

[](#translations)

Add `OzanAkman\Multilingual\Models\Traits\HasMultilingualContent` trait to your model files.

- Getting translated version of the model:

```
$model->translate('en');
```

- Translating model to other locales:

```
$model->translate('en', [
    'column' => 'translated_version'
]);
```

- Removing translation:

```
$model->removeTranslation('en');
```

- Handling translation slugs is so easy. You just need to add `slugSource()` method to your main model.

```
class ExampleModel extends Model
{
    public function slugSource()
    {
        // Column
        return 'title';
    }
}
```

And now when you add a translation Multilingual will generate `slug` from `title` column by `cocur/slugify` package.

Testing
-------

[](#testing)

Multilingual uses `Orchestra\Testbench` to run tests.

```
vendor/bin/phpunit
```

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

[](#contributing)

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

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 96% 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

Unknown

Total

1

Last Release

2748d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/160076233?v=4)[ozanakman](/maintainers/ozanakman)[@ozanakman](https://github.com/ozanakman)

---

Top Contributors

[![akmandev](https://avatars.githubusercontent.com/u/4144709?v=4)](https://github.com/akmandev "akmandev (24 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")

---

Tags

laravellocalizationmultilingualozan akman

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[themsaid/laravel-langman

Manage language files with ease.

871307.5k11](/packages/themsaid-laravel-langman)[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)[jayesh/laravel-gemini-translator

An interactive command to extract and generate Laravel translations using Gemini AI.

691.7k1](/packages/jayesh-laravel-gemini-translator)

PHPackages © 2026

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