PHPackages                             richan-fongdasen/laravel-i18n - 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. [Database &amp; ORM](/categories/database)
4. /
5. richan-fongdasen/laravel-i18n

ActiveLibrary[Database &amp; ORM](/categories/database)

richan-fongdasen/laravel-i18n
=============================

Simple route and eloquent localization / translation in Laravel

3.4.0(1y ago)1296.6k↓20.1%3[1 issues](https://github.com/richan-fongdasen/laravel-i18n/issues)[2 PRs](https://github.com/richan-fongdasen/laravel-i18n/pulls)MITPHPPHP ^8.0CI failing

Since Jun 5Pushed 1y ago1 watchersCompare

[ Source](https://github.com/richan-fongdasen/laravel-i18n)[ Packagist](https://packagist.org/packages/richan-fongdasen/laravel-i18n)[ Docs](https://github.com/richan-fongdasen/laravel-i18n)[ RSS](/packages/richan-fongdasen-laravel-i18n/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (12)Versions (18)Used By (0)

[![Build](https://github.com/richan-fongdasen/laravel-i18n/actions/workflows/main.yml/badge.svg?branch=main)](https://github.com/richan-fongdasen/laravel-i18n/actions/workflows/main.yml)[![codecov](https://camo.githubusercontent.com/863c02be8a97b88cef3497c7e3d8f902144d2a7398273083cdd261fedba46daa/68747470733a2f2f636f6465636f762e696f2f67682f72696368616e2d666f6e67646173656e2f6c61726176656c2d6931386e2f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/richan-fongdasen/laravel-i18n)[![StyleCI Analysis Status](https://camo.githubusercontent.com/77e625cf550a671bfbe0609c81b96d79035d50106a02dec796449db2d3edb4d9/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3133353738373339322f736869656c643f6272616e63683d6d6173746572)](https://github.styleci.io/repos/135787392)[![Total Downloads](https://camo.githubusercontent.com/ad30cd9cc16d3b9648f36fd6128344aa03cf868ceed471992329ac87de69e332/68747470733a2f2f706f7365722e707567782e6f72672f72696368616e2d666f6e67646173656e2f6c61726176656c2d6931386e2f642f746f74616c2e737667)](https://packagist.org/packages/richan-fongdasen/laravel-i18n)[![Latest Stable Version](https://camo.githubusercontent.com/cce04622a0e1f8a465f19b048760a8e2428d68840327b915c5dddeb9126c4dc5/68747470733a2f2f706f7365722e707567782e6f72672f72696368616e2d666f6e67646173656e2f6c61726176656c2d6931386e2f762f737461626c652e737667)](https://packagist.org/packages/richan-fongdasen/laravel-i18n)[![License: MIT](https://camo.githubusercontent.com/f45d904953153ca304a2328243d2733e095eee13a631a1f390709885d41dd692/68747470733a2f2f706f7365722e707567782e6f72672f6c61726176656c2f6672616d65776f726b2f6c6963656e73652e737667)](https://opensource.org/licenses/MIT)

Laravel I18n
============

[](#laravel-i18n)

> Simple Route localization and Eloquent translation in Laravel

Synopsis
--------

[](#synopsis)

This package provides easy ways to setup database translation and route localization.

Table of contents
-----------------

[](#table-of-contents)

- [Setup](#setup)
- [Publish package assets](#publish-package-assets)
- [Configuration](#configuration)
- [Documentation](#documentation)
- [Credits](#credits)
- [License](#license)

Setup
-----

[](#setup)

Install the package via Composer :

```
$ composer require richan-fongdasen/laravel-i18n
```

Publish package assets
----------------------

[](#publish-package-assets)

Publish the package asset files using this `php artisan` command

```
$ php artisan vendor:publish --provider="RichanFongdasen\I18n\ServiceProvider"
```

The command above would create three new files in your application, such as:

- New configuration file `/config/i18n.php`
- New database migration `/database/migrations/0000_00_00_000000_create_languages_table.php`
- New languages json file `/storage/i18n/languages.json`

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

[](#configuration)

```
return [

    /*
    |--------------------------------------------------------------------------
    | Language repository driver
    |--------------------------------------------------------------------------
    |
    | Define your language repository driver here. The available options are:
    | database and json.
    |
    */

    'driver' => 'json',

    /*
    |--------------------------------------------------------------------------
    | Language repository datasource
    |--------------------------------------------------------------------------
    |
    | Define your language repository datasource here.
    |   - Define your database table name, when you're using database driver.
    |   - Define your json file path, when you're using json driver.
    |
    */

    'language_datasource' => storage_path('i18n/languages.json'),
//    'language_datasource' => 'languages',

    /*
    |--------------------------------------------------------------------------
    | Cache duration
    |--------------------------------------------------------------------------
    |
    | Define how long we should cache the language dataset in seconds.
    |
    */

    'cache_duration' => 60 * 60 * 24,

    /*
    |--------------------------------------------------------------------------
    | Language key
    |--------------------------------------------------------------------------
    |
    | Define which language key in datasource that we should use.
    | Available options are:
    |   - language, ie: en, es, de, etc.
    |   - ietfCode, ie: en-US, en-UK, de-DE, etc.
    |
    */

    'language_key' => 'language',

    /*
    |--------------------------------------------------------------------------
    | API query key
    |--------------------------------------------------------------------------
    |
    | Define the query parameter name which will be used as language selector
    | in every API request.
    | e.g: http://localhost:8000/api/articles?lang=en
    |
    */

    'api_query_key' => 'lang',

    /*
    |--------------------------------------------------------------------------
    | Language negotiator class
    |--------------------------------------------------------------------------
    |
    | Define your language negotiator class here.
    | The class should implement LanguageNegotiator contract / interface.
    |
    */

    'negotiator' => \RichanFongdasen\I18n\Negotiators\BrowserNegotiator::class,

    /*
    |--------------------------------------------------------------------------
    | Locale URL segment number
    |--------------------------------------------------------------------------
    |
    | Define which url segment number that will be used to put the current
    | locale information. URL segment is started with '1'.
    | e.g: http://my-application.app/en/home
    |
    */

    'locale_url_segment' => 1,

    /*
    |--------------------------------------------------------------------------
    | Translation table suffix
    |--------------------------------------------------------------------------
    |
    | Define your preferred suffix to be appended to your database's
    | translation table name.
    |
    */

    'translation_table_suffix' => 'translations',

    /*
    |--------------------------------------------------------------------------
    | Enable Store to the cache
    |--------------------------------------------------------------------------
    |
    | Toggle store locale to the cache
    |
    */

    'enable_cache' => env('I18N_ENABLE_CACHE', true),

];
```

Documentation
-------------

[](#documentation)

Please check the documentation here

Credits
-------

[](#credits)

- [mcamara/laravel-localization](https://github.com/mcamara/laravel-localization) - Route localization concepts in this repository was inspired by this package.
- [Wico Chandra](https://github.com/wicochandra) - Database translation concepts in this repository was inspired by his `Model Translation` concept.
- [dimsav/laravel-translatable](https://github.com/dimsav/laravel-translatable) - Some of database translation concepts in this repository was inspired by this package.

License
-------

[](#license)

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

###  Health Score

47

—

FairBetter than 94% of packages

Maintenance42

Moderate activity, may be stable

Popularity38

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity76

Established project with proven stability

 Bus Factor1

Top contributor holds 87.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 ~153 days

Recently: every ~275 days

Total

17

Last Release

444d ago

Major Versions

1.5.2 → 2.0.02021-05-02

2.1.0 → 3.0.02022-02-22

PHP version history (6 changes)1.0.0PHP ^5.5.9 || ^7.0 || ^7.1.3

1.2.0PHP ^7.1.3

1.3.0PHP ^7.2

1.5.0PHP ^7.3

2.0.0PHP ^7.4|^8.0

3.3.0PHP ^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5222595?v=4)[Richan Fongdasen](/maintainers/richan-fongdasen)[@richan-fongdasen](https://github.com/richan-fongdasen)

---

Top Contributors

[![richan-fongdasen](https://avatars.githubusercontent.com/u/5222595?v=4)](https://github.com/richan-fongdasen "richan-fongdasen (57 commits)")[![laravel-shift](https://avatars.githubusercontent.com/u/15991828?v=4)](https://github.com/laravel-shift "laravel-shift (3 commits)")[![nsawitri](https://avatars.githubusercontent.com/u/42955044?v=4)](https://github.com/nsawitri "nsawitri (2 commits)")[![StyleCIBot](https://avatars.githubusercontent.com/u/11048387?v=4)](https://github.com/StyleCIBot "StyleCIBot (2 commits)")[![dependabot-preview[bot]](https://avatars.githubusercontent.com/in/2141?v=4)](https://github.com/dependabot-preview[bot] "dependabot-preview[bot] (1 commits)")

---

Tags

eloquenti18ninternationalizationintllaravellaravel-routeslocalizationroutestranslationlaravelintllocalizationinternationalizationi18nroutestranslationeloquentlaravel-packagelaravel-routes

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/richan-fongdasen-laravel-i18n/health.svg)

```
[![Health](https://phpackages.com/badges/richan-fongdasen-laravel-i18n/health.svg)](https://phpackages.com/packages/richan-fongdasen-laravel-i18n)
```

###  Alternatives

[cybercog/laravel-love

Make Laravel Eloquent models reactable with any type of emotions in a minutes!

1.2k302.7k1](/packages/cybercog-laravel-love)[cviebrock/eloquent-taggable

Easy ability to tag your Eloquent models in Laravel.

567694.8k3](/packages/cviebrock-eloquent-taggable)[reedware/laravel-relation-joins

Adds the ability to join on a relationship by name.

2121.2M13](/packages/reedware-laravel-relation-joins)[toponepercent/baum

Baum is an implementation of the Nested Set pattern for Eloquent models.

3154.7k](/packages/toponepercent-baum)

PHPackages © 2026

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