PHPackages                             nxmad/eloquent-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. [Localization &amp; i18n](/categories/localization)
4. /
5. nxmad/eloquent-i18n

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

nxmad/eloquent-i18n
===================

Internationalization of Eloquent Models

0.1.2(6y ago)249MITPHPPHP ^7.0

Since May 23Pushed 6y ago1 watchersCompare

[ Source](https://github.com/nxmad/eloquent-i18n)[ Packagist](https://packagist.org/packages/nxmad/eloquent-i18n)[ RSS](/packages/nxmad-eloquent-i18n/feed)WikiDiscussions master Synced yesterday

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

Eloquent-i18n
=============

[](#eloquent-i18n)

Internationalization helper for Eloquent models.

### Installation

[](#installation)

1. Pull the latest version using composer: ```
    composer require nxmad/eloquent-i18n
    ```
2. Publish database migration: ```
    php artisan vendor:publish --provider="Nxmad\EloquentI18n\EloquentI18nProvider"
    ```
3. Use trait in your models: ```
    use Nxmad\EloquentI18n\Traits\HasTranslations;

    class Something extends Model
    {
        use HasTranslations;

        // ...
    }
    ```

### Usage guide

[](#usage-guide)

Add translations:

```
$translations = [
    'title' => [
        'en' => 'Hello, world!',
        'de' => 'Hallo Welt!',
    ],

    'content' => [
        'en' => 'This is my page content.',
        'de' => 'Dies ist mein Seiteninhalt.',
    ]
];

$page = new Page();

// First way
$page->translations = $translations;

// Alt. way
$page->addTranslations($translations);
$page->addTranslations('title', 'Hello, world!'); // would add translation for current locale
$page->addTranslations('title', 'Hello, world!', 'en'); // would add translation for specified locale

$page->save();
```

Remove translations:

```
// Remove all existing translations
$page->removeTranslations();

// Remove by the key
$page->removeTranslations('title');

// Remove by locale
$page->removeTranslations(null, 'de');

// Or both:
$page->removeTranslations('title', 'de');
```

Get translated value:

```
app()->setLocale('de');
echo $page->title; // Hallo Welt!

app()->setLocale('en');
echo $page->title; // Hello, world!

// alt. way
$page->getTranslation('title', 'default', 'en'); // Hello, world!
$page->getTranslation('non-existing-key', 'default', 'en'); // default

// get all translations for key
$page->getAllTranslations('title');

// serialize
echo $page->toJson(); // { id, title, content, etc. }
```

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity47

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

Total

4

Last Release

2276d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/15c754eb8dad63c3b1d88a20e89c6b9c02c2c5e3523d13e161a4c59634a4de05?d=identicon)[nxmad](/maintainers/nxmad)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/nxmad-eloquent-i18n/health.svg)

```
[![Health](https://phpackages.com/badges/nxmad-eloquent-i18n/health.svg)](https://phpackages.com/packages/nxmad-eloquent-i18n)
```

###  Alternatives

[mcamara/laravel-localization

Easy localization for Laravel

3.5k9.1M112](/packages/mcamara-laravel-localization)[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)[vemcogroup/laravel-translation

Translation package for Laravel to scan for localisations and up/download to poeditor

135304.0k2](/packages/vemcogroup-laravel-translation)

PHPackages © 2026

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