PHPackages                             candeno/laravel-translations - 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. candeno/laravel-translations

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

candeno/laravel-translations
============================

EAV-based per-locale translations for Eloquent models — stores translated field values in a shared translations table with a HasTranslations trait for get/set/bulk-write operations.

1.0.0(1mo ago)0187↓60.4%MITPHPPHP ^8.2

Since Apr 24Pushed 1mo agoCompare

[ Source](https://github.com/Candeno/laravel-translations)[ Packagist](https://packagist.org/packages/candeno/laravel-translations)[ RSS](/packages/candeno-laravel-translations/feed)WikiDiscussions main Synced 1w ago

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

candeno/laravel-translations
============================

[](#candenolaravel-translations)

EAV-based per-locale translations for Eloquent models. Stores translated field values in a shared `translations` table with a `HasTranslations` trait for get/set/bulk-write operations.

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

[](#installation)

```
composer require candeno/laravel-translations
```

Publish and run the migration:

```
php artisan vendor:publish --tag=candeno-translations-migrations
php artisan migrate
```

Usage
-----

[](#usage)

Add the trait to any Eloquent model:

```
use Candeno\LaravelTranslations\Concerns\HasTranslations;

class Activity extends Model
{
    use HasTranslations;

    protected array $translatable = ['title', 'subtitle', 'why_text'];
}
```

### Get a translation

[](#get-a-translation)

```
// Falls back: requested locale → fallback locale → raw model attribute
$activity->getTranslation('title', 'uk', 'da');
```

### Set a translation

[](#set-a-translation)

```
$activity->setTranslation('title', 'uk', 'Назва');
```

### Set all locales for a field

[](#set-all-locales-for-a-field)

```
$activity->setTranslations('title', [
    'da' => 'Titel',
    'uk' => 'Назва',
]);
```

### Bulk-write from a localizedContent map

[](#bulk-write-from-a-localizedcontent-map)

Useful when consuming the automation form payload directly:

```
// $localizedContent = ['da' => ['title' => '...', 'description' => '...'], 'uk' => [...]]
$activity->setLocalizedContent($localizedContent, [
    'title'       => 'title',
    'description' => 'subtitle',
    'buttonText'  => 'action_label',
]);
```

Schema
------

[](#schema)

columntypenotes`table_name``varchar`Eloquent model table`row_id``varchar`Model primary key (int or UUID)`locale``varchar(10)`e.g. `da`, `uk`, `en``field``varchar`Model field name`value``text`Translated valueA unique index on `(table_name, row_id, locale, field)` ensures upserts are safe.

###  Health Score

42

—

FairBetter than 88% of packages

Maintenance90

Actively maintained with recent releases

Popularity15

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity46

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

Unknown

Total

1

Last Release

46d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/774fe119527dce19a27dbe99ddbbd207e69a3caba9d2e0a6dc5f6258e24b7bfe?d=identicon)[hicandeno](/maintainers/hicandeno)

---

Top Contributors

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

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/candeno-laravel-translations/health.svg)

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

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3325.1M337](/packages/psalm-plugin-laravel)[spatie/laravel-health

Monitor the health of a Laravel application

88011.3M149](/packages/spatie-laravel-health)[yajra/laravel-oci8

Oracle DB driver for Laravel via OCI8

8733.1M23](/packages/yajra-laravel-oci8)[pressbooks/pressbooks

Pressbooks is an open source book publishing tool built on a WordPress multisite platform. Pressbooks outputs books in multiple formats, including PDF, EPUB, web, and a variety of XML flavours, using a theming/templating system, driven by CSS.

45344.0k1](/packages/pressbooks-pressbooks)[api-platform/laravel

API Platform support for Laravel

59156.3k10](/packages/api-platform-laravel)[rapidez/core

Rapidez Core

1822.4k65](/packages/rapidez-core)

PHPackages © 2026

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