PHPackages                             codanux/multi-language - 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. codanux/multi-language

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

codanux/multi-language
======================

Multi Language Laravel

v1.0.2(5y ago)172MITPHPPHP ^7.3

Since Oct 28Pushed 4y ago1 watchersCompare

[ Source](https://github.com/codanux/multi-language)[ Packagist](https://packagist.org/packages/codanux/multi-language)[ Docs](https://github.com/codanux/multi-language)[ RSS](/packages/codanux-multi-language/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependencies (3)Versions (4)Used By (0)

Laravel Multi Language Package
==============================

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

[![Latest Version on Packagist](https://camo.githubusercontent.com/77c1893eab8ee296df148d8c0c32bd4792815960aa5470234aec3e5aba0ae8a0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f636f64616e75782f6d756c74692d6c616e67756167652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/codanux/multi-language)[![Build Status](https://camo.githubusercontent.com/60b16b0fba81baefa6d05d2286e0f9719b99f3f597b9a582628cd0346c3903c5/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f636f64616e75782f6d756c74692d6c616e67756167652f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/codanux/multi-language)[![Quality Score](https://camo.githubusercontent.com/e86f6434155374002a5bf4e6849f961f5e4f4bf1f40a069438d28c83e70fb132/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f636f64616e75782f6d756c74692d6c616e67756167652e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/codanux/multi-language)[![Total Downloads](https://camo.githubusercontent.com/0d9411ebc6fe91fe835373821f11f85b019376cd7d5459acce60298b25762df7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f636f64616e75782f6d756c74692d6c616e67756167652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/codanux/multi-language)

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

[](#installation)

You can install the package via composer:

```
composer require codanux/multi-language
```

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

[](#configuration)

```
php artisan vendor:publish --provider="Codanux\MultiLanguage\MultiLanguageServiceProvider"
```

To detect and change the locale of the application based on the request automatically:

```
config/multi-language.php

'middleware' => [
    'web' => [
        \Codanux\MultiLanguage\DetectRequestLocale::class
    ]
],
```

Model
-----

[](#model)

```
class Post extends Model // implements HasMedia
{
    use HasLanguage;
    // use InteractsWithMedia, MediaTrait { MediaTrait::getMedia insteadof InteractsWithMedia; }
}
```

Migration
---------

[](#migration)

```
Schema::create('posts', function (Blueprint $table) {
    $table->id();
    $table->string('name');
    $table->locale(); // added
});
```

Route
-----

[](#route)

```
Route::localeResource('post', 'PostController')->names('post');
or
Route::locale('post.index', 'PostController@index');
Route::locale('post.show', 'PostController@show');
Route::locale('post.create', 'PostController@create');
Route::locale('post.create', 'PostController@store')->method('POST');
Route::locale('post.edit', 'PostController@edit');
Route::locale('post.edit', 'PostController@update')->method('PUT');
Route::locale('post.destroy', 'PostController@destroy')->method('DELETE');

Route::locale('dashboard', function () {
    return view('dashboard');
})
->name('home');

Route::group(['localePrefix' => 'admin.prefix'], function (){

    Route::locale('admin.dashboard', function () {
        return view('admin.dashboard');
    });

});
```

Route Usage
-----------

[](#route-usage)

```
routeLocalized('post.show', $post)

| Method    | URI           | Name          | Action                              |
|-----------|---------------|---------------|-------------------------------------|
| GET\|HEAD | posts/{post}  | en.post.show  | App\Http\Controllers\PostController@show |
| GET\|HEAD | tr/postlar/{post} | tr.post.show | App\Http\Controllers\PostController@show |
```

Controller
----------

[](#controller)

```
public function index()
{
    // locale scope
    $posts = (new Post())->newQuery()->locale()->get();
}

public function store(Request $request)
{
    $post = Post::create([
       'name' => 'Post en',
       'locale' => 'en',
   ]);

    Post::create([
       'name' => 'Post tr',
       'locale' => 'tr',
       'locale_slug' => 'post-1',
       'translation_of' => $post->translation_of
    ]);

    Post::localeSlug('post-1', 'tr')->first(); // Post tr

    Post::localeSlug('post-1', 'en')->first(); // Post en
}

public function show(Post $post)
{
    return view('post.show', compact('post'));
}
```

Views
-----

[](#views)

```
post.index

post.show
     $post]>

    //category/{category}/posts/{post}

    // route model translations ['category' => $category, 'post => $post]
```

Jetstream Router
----------------

[](#jetstream-router)

```
1. config/multi-language.php

'fortify' => [
    'routes' => true,
],

'jetstream' => [
    'routes' => true,
]

2. Default Router İgnore

class FortifyServiceProvider extends ServiceProvider
{
    public function register()
    {
        Fortify::ignoreRoutes();
    }
}

class JetstreamServiceProvider extends ServiceProvider
{
   public function register()
   {
       Jetstream::ignoreRoutes();
   }
}
```

### Testing

[](#testing)

```
composer test
```

### Changelog

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

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

[](#contributing)

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

### Security

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Ömer](https://github.com/codanux)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

Laravel Package Boilerplate
---------------------------

[](#laravel-package-boilerplate)

This package was generated using the [Laravel Package Boilerplate](https://laravelpackageboilerplate.com).

###  Health Score

24

—

LowBetter than 31% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity51

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 ~81 days

Total

3

Last Release

1911d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7c57fc10d3daad8d9c418c0f062c0c6a0415d834c9d45fbf107614b9bbe78974?d=identicon)[codanux](/maintainers/codanux)

---

Top Contributors

[![codanux](https://avatars.githubusercontent.com/u/46086920?v=4)](https://github.com/codanux "codanux (9 commits)")

---

Tags

laravellaravel-multi-languagemulti-languagelaravelmulti-languagecodanux

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/codanux-multi-language/health.svg)

```
[![Health](https://phpackages.com/badges/codanux-multi-language/health.svg)](https://phpackages.com/packages/codanux-multi-language)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M345](/packages/psalm-plugin-laravel)[erag/laravel-lang-sync-inertia

A powerful Laravel package for syncing and managing language translations across backend and Inertia.js (Vue/React/Svelte) frontends, offering effortless localization, auto-sync features, and smooth multi-language support for modern Laravel applications.

4925.3k](/packages/erag-laravel-lang-sync-inertia)[bezhansalleh/filament-language-switch

Zero config Language Switch(Changer/Localizer) plugin for filamentphp admin

3581.3M28](/packages/bezhansalleh-filament-language-switch)[api-platform/laravel

API Platform support for Laravel

58171.5k14](/packages/api-platform-laravel)[orkhanahmadov/spreadsheet-translations

Spreadsheet translations for Laravel

226.4k](/packages/orkhanahmadov-spreadsheet-translations)

PHPackages © 2026

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