PHPackages                             typicms/translatable - 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. typicms/translatable

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

typicms/translatable
====================

A trait to make an Eloquent model hold translations

2.0.1(1mo ago)11.2k↓87.5%3MITPHPPHP ^8.0CI passing

Since Nov 2Pushed 1mo agoCompare

[ Source](https://github.com/TypiCMS/Translatable)[ Packagist](https://packagist.org/packages/typicms/translatable)[ Docs](https://github.com/typicms/translatable)[ GitHub Sponsors](https://github.com/typicms)[ RSS](/packages/typicms-translatable/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (10)Versions (5)Used By (3)

A trait to make Eloquent models translatable
============================================

[](#a-trait-to-make-eloquent-models-translatable)

[![Latest Version on Packagist](https://camo.githubusercontent.com/5a8966b6638970191548db50cd96ab9d71217f592c218573b8f94f633c3b6300/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f74797069636d732f7472616e736c617461626c652e737667)](https://packagist.org/packages/typicms/translatable)[![MIT Licensed](https://camo.githubusercontent.com/074b89bca64d3edc93a1db6c7e3b1636b874540ba91d66367c0e5e354c56d0ea/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e737667)](LICENSE.md)[![run-tests](https://github.com/typicms/translatable/actions/workflows/tests.yml/badge.svg?branch=main)](https://github.com/typicms/translatable/actions/workflows/tests.yml)[![PHPStan](https://github.com/typicms/translatable/actions/workflows/phpstan.yml/badge.svg?branch=main)](https://github.com/typicms/translatable/actions/workflows/phpstan.yml)[![Rector](https://github.com/typicms/translatable/actions/workflows/rector.yml/badge.svg?branch=main)](https://github.com/typicms/translatable/actions/workflows/rector.yml)

This project is based on spatie/laravel-translatable, it resolves inconsistencies that have arisen over time in the initial project.

This package contains a trait `HasTranslations` to make Eloquent models translatable. Translations are stored as json. There is no extra table needed to hold them.

```
use Illuminate\Database\Eloquent\Model;
use TypiCMS\Translatable\HasTranslations;

class NewsItem extends Model
{
    use HasTranslations;

    // ...
}
```

After the trait is applied on the model, you can do these things:

```
$newsItem = new NewsItem;
$newsItem
   ->setTranslation('name', 'en', 'Name in English')
   ->setTranslation('name', 'nl', 'Naam in het Nederlands')
   ->save();

$newsItem->name; // Returns 'Name in English' given that the current app locale is 'en'
$newsItem->getTranslation('name', 'nl'); // returns 'Naam in het Nederlands'

app()->setLocale('nl');

$newsItem->name; // Returns 'Naam in het Nederlands'

// If you want to query records based on locales, you can use the `whereLocale` and `whereLocales` methods.

NewsItem::whereLocale('name', 'en')->get(); // Returns all news items with a name in English

NewsItem::whereLocales('name', ['en', 'nl'])->get(); // Returns all news items with a name in English or Dutch
```

Testing
-------

[](#testing)

```
composer test
```

Security
--------

[](#security)

If you've found a bug regarding security, please mail  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Freek Van der Herten](https://github.com/freekmurze)
- [Sebastian De Deyne](https://github.com/sebastiandedeyne)
- [Samuel De Backer](https://github.com/sdebacker)
- [All Contributors](https://github.com/spatie/laravel-translatable/graphs/contributors)

We got the idea to store translations as JSON in a column from [Mohamed Said](https://github.com/themsaid). Parts of the readme of [his multilingual package](https://github.com/themsaid/laravel-multilingual) were used in this readme.

License
-------

[](#license)

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

###  Health Score

44

—

FairBetter than 92% of packages

Maintenance89

Actively maintained with recent releases

Popularity22

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 88.2% 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 ~65 days

Total

3

Last Release

57d ago

Major Versions

1.0.0 → 2.0.02026-03-13

### Community

Maintainers

![](https://www.gravatar.com/avatar/b93740e4c6b40a6219441696db5db9c4b635dad91339c1893dfe0813434e8d94?d=identicon)[Samuel De Backer](/maintainers/Samuel%20De%20Backer)

---

Top Contributors

[![sdebacker](https://avatars.githubusercontent.com/u/134503?v=4)](https://github.com/sdebacker "sdebacker (15 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (1 commits)")

---

Tags

laraveltranslatemodeleloquentmultilingualtranslatablei10nTypiCMS

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/typicms-translatable/health.svg)

```
[![Health](https://phpackages.com/badges/typicms-translatable/health.svg)](https://phpackages.com/packages/typicms-translatable)
```

###  Alternatives

[spatie/laravel-translatable

A trait to make an Eloquent model hold translations

2.4k23.0M412](/packages/spatie-laravel-translatable)[dyrynda/laravel-model-uuid

This package allows you to easily work with UUIDs in your Laravel models.

4802.8M8](/packages/dyrynda-laravel-model-uuid)[tucker-eric/eloquentfilter

An Eloquent way to filter Eloquent Models

1.8k4.8M26](/packages/tucker-eric-eloquentfilter)[sebastiaanluca/laravel-boolean-dates

Automatically convert Eloquent model boolean attributes to dates (and back).

40111.7k1](/packages/sebastiaanluca-laravel-boolean-dates)[rinvex/laravel-tenants

Rinvex Tenants is a contextually intelligent polymorphic Laravel package, for single db multi-tenancy. You can completely isolate tenants data with ease using the same database, with full power and control over what data to be centrally shared, and what to be tenant related and therefore isolated from others.

823.4k10](/packages/rinvex-laravel-tenants)

PHPackages © 2026

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