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

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

aegued/laravel-translations
===========================

Create translations of the fields of a Model and save them in the database

v1.04(11mo ago)493MITPHPPHP &gt;=5.6.4

Since Sep 26Pushed 11mo ago1 watchersCompare

[ Source](https://github.com/aegued/laravel-translations)[ Packagist](https://packagist.org/packages/aegued/laravel-translations)[ RSS](/packages/aegued-laravel-translations/feed)WikiDiscussions master Synced 2d ago

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

Laravel Translations
====================

[](#laravel-translations)

It's a Laravel model columns translation manager

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

[](#installation)

You can install the package via composer:

```
composer require aegued/laravel-translations
```

If you have Laravel 5.5 and up The package will automatically register itself.

else you have to add the service provider to app/config/app.php

```
Aegued\LaravelTranslations\LaravelTranslationsServiceProvider::class,
```

If you want to change the default locale, you must publish the config file:

```
php artisan vendor:publish --provider="Aegued\LaravelTranslations\LaravelTranslationsServiceProvider"
```

This is the contents of the published file:

```
return [

   /**
    * Default Locale || Root columns locale
    * We will use this locale if config('app.locale') translation not exist
    */
   'locale' => 'en',

   /**
    * Supported Locales e.g: ['en', 'es', 'fr']
    */
   'locales' => ['es', 'en', 'fr']

];
```

next migrate translations table

```
php artisan migrate
```

Making a model translatable
---------------------------

[](#making-a-model-translatable)

The required steps to make a model translatable are:

- Just use the `Aegued\LaravelTranslations\Translatable` trait.

Here's an example of a prepared model:

```
use Illuminate\Database\Eloquent\Model;
use Aegued\LaravelTranslations\Translatable;

class Item extends Model
{
    use Translatable;

    /**
      * The attributes that are Translatable.
      *
      * @var array
      */
    protected $translatable = [
        'name', 'color'
    ];
}
```

### Available methods

[](#available-methods)

Saving translations

```
$item = new Item;
$data = array('en' => 'car', 'es' => 'coche');

$item->setTranslations('name', $data); // setTranslations($attribute, array $translations, $save = false)

// or save one translation
$item->setTranslation('name', 'en', 'car', true); // setTranslation($attribute, $locale, $value, $save = false)

// or just do
$item->name = 'car'; // note: this will save automaticaly unless it's the default locale

// This will save if (current locale == default locale OR $save = false)
$item->save();
```

Get translations

```
$item = new Item::first();
// get current locale translation
$item->city
OR
$item->getTranslation('city');

// pass translation locales
$item->getTranslation('city', 'es'); // getTranslation($attribute, $language = null, $fallback = true)
$item->getTranslationsOf('name', ['es', 'en']); // getTranslationsOf($attribute, array $languages = null, $fallback = true)
```

Delete translations

```
$item = new Item::first();
$item->deleteTranslations(['name', 'color'], ['es', 'en']); // deleteTranslations(array $attributes, $locales = null)
```

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance50

Moderate activity, may be stable

Popularity15

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 85.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 ~565 days

Total

4

Last Release

358d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3273d4224968c1f0831be0285dd1c7b5a2267f199db678361385e2f156332b3b?d=identicon)[aegued](/maintainers/aegued)

---

Top Contributors

[![aegued](https://avatars.githubusercontent.com/u/8310733?v=4)](https://github.com/aegued "aegued (6 commits)")[![aeguedlabelgrup](https://avatars.githubusercontent.com/u/66358498?v=4)](https://github.com/aeguedlabelgrup "aeguedlabelgrup (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[symfony/translation

Provides tools to internationalize your application

6.6k836.5M2.1k](/packages/symfony-translation)[nesbot/carbon

An API extension for DateTime that supports 281 different languages.

169661.4M4.8k](/packages/nesbot-carbon)[joedixon/laravel-translation

A tool for managing all of your Laravel translations

717911.4k11](/packages/joedixon-laravel-translation)[illuminate/translation

The Illuminate Translation package.

6936.4M495](/packages/illuminate-translation)[lajax/yii2-translate-manager

Translation management extension for Yii 2

227578.8k13](/packages/lajax-yii2-translate-manager)[larswiegers/laravel-translations-checker

Make sure your laravel translations are checked and are included in all languages.

256423.2k2](/packages/larswiegers-laravel-translations-checker)

PHPackages © 2026

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