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

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

mihkullorg/laravel-translatable
===============================

Laravel package for multilingual models with Google Cloud Translate

1.2.3(7y ago)02091MITPHPPHP &gt;=7.1.3

Since Jan 12Pushed 7y ago1 watchersCompare

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

READMEChangelog (7)Dependencies (5)Versions (8)Used By (0)

Laravel translatable
====================

[](#laravel-translatable)

[![Latest Stable Version](https://camo.githubusercontent.com/5df00420287a9cbdd38f236d3ef7c947f42f1f72a6798022823fc61f54ae7dc0/68747470733a2f2f706f7365722e707567782e6f72672f6d69686b756c6c6f72672f6c61726176656c2d7472616e736c617461626c652f76657273696f6e)](https://packagist.org/packages/mihkullorg/laravel-translatable)[![Total Downloads](https://camo.githubusercontent.com/a7c4bef222883c50c715814877113122261da5522bc44549c4c40db662a3d6d8/68747470733a2f2f706f7365722e707567782e6f72672f6d69686b756c6c6f72672f6c61726176656c2d7472616e736c617461626c652f646f776e6c6f616473)](https://packagist.org/packages/mihkullorg/laravel-translatable)[![Build status](https://camo.githubusercontent.com/70137fca9c5bf6afd39b82dc5392850bfbef210163c3da94c7b46a9184021c60/68747470733a2f2f636972636c6563692e636f6d2f67682f6d69686b656c616c6c6f72672f6c61726176656c2d7472616e736c617461626c652e706e673f7374796c653d736869656c64)](https://circleci.com/gh/mihkelallorg/laravel-translatable)[![StyleCI](https://camo.githubusercontent.com/dd638e9ddf22cec3ce80f7288ce199ba78505146bcdd15ef58d895357bfda1fc/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3136353036323832362f736869656c643f6272616e63683d6d6173746572)](https://github.styleci.io/repos/165062826)[![License](https://camo.githubusercontent.com/377ac8b0b7093fbb3eaa63231a4706876c4c131e23461726aa591efc914703eb/68747470733a2f2f706f7365722e707567782e6f72672f6d69686b756c6c6f72672f6c61726176656c2d7472616e736c617461626c652f6c6963656e7365)](https://packagist.org/packages/mihkullorg/laravel-translatable)

This is a Laravel package for (auto)translatable models. It provides functionality of multilingual models with an option of using external services for automatic translations. [Google Cloud Translate](https://cloud.google.com/translate/docs/) is already integrated into the package and adding another service is made pretty easy.

If you're not interested in using any automatic translation services, and just looking to make your models multilingual I suggest using [dismav/laravel-translatable package](https://packagist.org/packages/dimsav/laravel-translatable) as it has a lot more history and community behind it is way way larger.

### Index

[](#index)

- [Info](#info)
- [Quick start](#quick-start)
- [FAQ](#faq)
- [Contribution](#contribution)

Info
----

[](#info)

The package is create for Laravel 5.6 and 5.7.

Quick start
-----------

[](#quick-start)

#### Step 1: Install package

[](#step-1-install-package)

Add the package in your composer.json by executing the command.

`composer require mihkullorg/laravel-translatable`

Next, add the service provider to `config/app.php`

`Mihkullorg\Translatable\TranslatableServiceProvider::class`

#### Step 2: Set up the environment and migration.

[](#step-2-set-up-the-environment-and-migration)

Publish the migration file.

`php artisan vendor:publish --tag=translatable`

Set up your [Google Cloud Translate/GCT](https://cloud.google.com/translate/docs/) service account and select your preferred way of authentication from [Googe Cloud authenticiation docs](https://cloud.google.com/docs/authentication/). As Google supports authenticating through environment variables and it being really comfortable, this package is using it too. I prefer authenticating by setting `GOOGLE_APPLICATION_CREDENTIALS` variable to the path of the provided service account private key file.

#### Step 3: Add Translatable trait to model

[](#step-3-add-translatable-trait-to-model)

```
use Mihkullorg\Translatable\Traits\Translatable;

class Post extends Model
{
    use Translatable;

    public $fillable = ['body'];
}
```

The trait adds necessary translation relationship methods

```
$post->translations();
$post->translation($field, $language, $createIfNotFresh = false);
```

Translation is "fresh" when the `updated_at` of the `Translation` model is older than the `update_at` of the `Translatable` model.

```
$post->freshTranslation($field, $language);
```

To create a translation manually, you can call method `translate($field, $language, $value = null)`

```
$post->translate('body', 'en', 'New translated body');
```

To use the GCT service, do not specify the value and the translation is retrieved and model created automatically.

```
$translation = $post->translate('body', 'en');
```

`translation` method acts similarly and if `$createIfNotFresh` is set `true`, it tries to retrieve a fresh translation from the database and if none exists, uses the GCT service.

FAQ
---

[](#faq)

- What about Laravel &lt;5.6?

I'm honestly not sure whether it would work with older version than 5.6 but as of creating this package, only 5.6 and 5.7 are officially supported. If anyone is willing to test it on earlier versions and make sure it works, create an issue and let's discuss it.

Contribution
------------

[](#contribution)

Feel free to create issues and make PRs to make this package better. I hope you do. :)

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 96.6% 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 ~28 days

Total

7

Last Release

2558d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f97d3a783ca2eac7bc4dcd0a9f78b5fc8dc8311b1640b135c2020d19d048d92c?d=identicon)[Mihkullorg](/maintainers/Mihkullorg)

---

Top Contributors

[![mihkelallorg](https://avatars.githubusercontent.com/u/8766719?v=4)](https://github.com/mihkelallorg "mihkelallorg (28 commits)")[![ArturKp](https://avatars.githubusercontent.com/u/3534968?v=4)](https://github.com/ArturKp "ArturKp (1 commits)")

---

Tags

laraveltranslategoogle-translate

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[erag/laravel-lang-sync-inertia

A powerful Laravel package for syncing and managing language translations across backend and Inertia.js (Vue/React) frontends, offering effortless localization, auto-sync features, and smooth multi-language support for modern Laravel applications.

4821.5k](/packages/erag-laravel-lang-sync-inertia)[itsmattburgess/laravel-translate

Populate laravel translation files using services such as Google Translate

222.5k](/packages/itsmattburgess-laravel-translate)

PHPackages © 2026

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