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

AbandonedArchivedComposer-package[Localization &amp; i18n](/categories/localization)

fomvasss/laravel-translatable
=============================

A package to manage SEO (meta-tags, xml-fields, etc.)

1.1.0(5y ago)013MITPHPPHP ^7.3|^7.4|^8.0

Since Dec 28Pushed 5y ago1 watchersCompare

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

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

Make translations for Eloquent models
=====================================

[](#make-translations-for-eloquent-models)

[![License](https://camo.githubusercontent.com/729d6307bc089bf8a5fbe5071fafdc67879d611b9198a8342446a7a9d931866f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f666f6d76617373732f6c61726176656c2d7472616e736c617461626c652e7376673f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/fomvasss/laravel-translatable)[![Build Status](https://camo.githubusercontent.com/08209c81a0c96cb6b19c47c6dea2fc16200d4472c30642491de0f30a6c714782/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f666f6d76617373732f6c61726176656c2d7472616e736c617461626c652e7376673f7374796c653d666f722d7468652d6261646765)](https://github.com/fomvasss/laravel-translatable)[![Latest Stable Version](https://camo.githubusercontent.com/d9e6becf28a29c02bbfebbca4a10a10c8450df76856eb0d37e3850366cd35956/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f666f6d76617373732f6c61726176656c2d7472616e736c617461626c652e7376673f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/fomvasss/laravel-translatable)[![Total Downloads](https://camo.githubusercontent.com/13b58f337bb83909d7ee76c643de54ea599c669c5df6918f31552b9656c07a99/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f666f6d76617373732f6c61726176656c2d7472616e736c617461626c652e7376673f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/fomvasss/laravel-translatable)[![Quality Score](https://camo.githubusercontent.com/3e42ace7723ae27c00bd9cfce380dfdf3b0228b2117731cb4f9d46ec348751fd/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f666f6d76617373732f6c61726176656c2d7472616e736c617461626c652e7376673f7374796c653d666f722d7468652d6261646765)](https://scrutinizer-ci.com/g/fomvasss/laravel-translatable)

This is a Laravel package for creating translations content of Eloquent-models. For translation, created models in different languages, between which relations is established through additional fields. The main advantage is that there is no need to create additional tables, models or specific JSON-fields, all operations occur without changes. The functionality is very easy to integrate into an existing / running project. All you need to do is add two fields to the desired table / model by connecting one PHP-Trait.

---

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

[](#installation)

To install the package, in terminal:

```
composer require fomvasss/laravel-translatable
```

### Publish

[](#publish)

Run in terminal:

```
php artisan vendor:publish --provider="Fomvasss\LaravelTranslatable\ServiceProvider"
```

A configuration file will be published to `config/translatable.php`.

### Usage

[](#usage)

1. Add columns (`langcode` &amp; `translation_uuid` in translatable DB-table:

Example:

```
Schema::create('articles', function (Blueprint $table) {
    ...
    $table->translatable();
});

// To drop columns
Schema::table('articles', function (Blueprint $table) {
    $table->dropTranslatable();
});

```

2. Your model should use `Fomvasss\LaravelTranslatable\Traits\HasTranslations` trait to enable translations:

Example: `app/Models/Article.php`

```
use Fomvasss\LaravelTranslatable\Traits\HasTranslations;

class Article extends Model
{
    use HasTranslations;
    //...
}
```

3. Get and Save article translations in your controller:

Example controller: `app/Http/Controllers/ArticleController.php`

```
class ArticleController extends Controller
{
    public function index(Request $request)
    {
        // Select by config('app.locale'):
        $articles = \App\Model\Article::byLang()->paginate();
        // OR by request
        $articles = \App\Model\Article::byLang($request->lang)->paginate();
        // ...
    }

    public function store(Request $request)
    {
    	// Let's create an article in English (en)
        $article1 = \App\Model\Article::create([
            'name' => 'Article 1, for EN language',
            'langcode' => 'en',
        ]);

        // For the saved article ($article1)  will be auto-generated UUID
        // Example: 70cf3963-cf41-464c-9d81-411d3a524789

        // We will create a translation into Ukrainian (uk) for the article ($article1)
        $article2 = \App\Model\Article::create([
            'name' => 'Стаття 1, для UK мови',
            'langcode' => 'uk',
            'translation_uuid' => $article1->uuid,
        ]);
        // OR
        $article2 = \App\Model\Article::create(['name' => 'Стаття 1, для UK мови']);
        $article2->saveTranslatable('uk', $article1->uuid);

        // A couple langcode & translation_uuid must be unique
        // ...
    }

    public function show($id)
    {
        $article = \App\Model\Article::findOrFail($id);

        // Get related translations list for article
        $translation = $article->getTranslationList();

        return view('stow', compact('article', 'translation'));
    }
}
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Fomin Vasyl](https://github.com/fomvasss)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

**Happy coding**!

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity59

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

Total

2

Last Release

1961d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4f99b460639e7d6871597882226b1e0d9e3055992eac8b22bfcd4f90fbdac95c?d=identicon)[fomvasss](/maintainers/fomvasss)

---

Top Contributors

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

---

Tags

laravellocalizationlanguagetranslationmultilinguallaravel-translatable

### Embed Badge

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

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

###  Alternatives

[codezero/laravel-localized-routes

A convenient way to set up, manage and use localized routes in a Laravel app.

543638.1k4](/packages/codezero-laravel-localized-routes)[opgginc/codezero-laravel-localized-routes

A convenient way to set up, manage and use localized routes in a Laravel app.

2770.1k1](/packages/opgginc-codezero-laravel-localized-routes)[longman/laravel-multilang

Package to integrate multi language (multi locale) functionality in Laravel 5.x

5514.4k1](/packages/longman-laravel-multilang)[awes-io/localization-helper

Package for convenient work with Laravel's localization features

3527.1k4](/packages/awes-io-localization-helper)[zachleigh/laravel-lang-bundler

Create Laravel translations bundles.

2512.5k](/packages/zachleigh-laravel-lang-bundler)

PHPackages © 2026

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