PHPackages                             onurkacmaz/laravel-model-translate - 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. onurkacmaz/laravel-model-translate

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

onurkacmaz/laravel-model-translate
==================================

This package allows model translation. It is like Symfony's gedmo translation package.

v1.0.0(3y ago)214MITPHPPHP ^8.0

Since Feb 20Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/onurkacmaz/laravel-model-translate)[ Packagist](https://packagist.org/packages/onurkacmaz/laravel-model-translate)[ Docs](https://github.com/onurkacmaz/laravel-model-translate)[ RSS](/packages/onurkacmaz-laravel-model-translate/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (3)Versions (3)Used By (0)

Laravel Model Translate
=======================

[](#laravel-model-translate)

[![Latest Version on Packagist](https://camo.githubusercontent.com/a85d89ebb748938176f6615236beb9b2ce1da6b47d8f29865ab88765d11aa3c4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6f6e75726b61636d617a2f6c61726176656c2d6d6f64656c2d7472616e736c6174652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/onurkacmaz/laravel-model-translate)[![Total Downloads](https://camo.githubusercontent.com/02409f34b021712beeb9394f857167bfb2fb2767b59d9756e1d1bd9d25564864/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6f6e75726b61636d617a2f6c61726176656c2d6d6f64656c2d7472616e736c6174652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/onurkacmaz/laravel-model-translate)

This package allows model translation. It is like Symfony's gedmo translation package. It is very easy to use. You can use it in your models or controllers. Basically, it is a trait that you can use in your models. It will automatically create translation records of the fields you specify in the model. It will show the translation according to the registered locale. When creating or updating it will use the registered locale and will process that record. The main table pairs with "foreign\_id" and "model namespace" to the translations table.

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

[](#installation)

You can install the package via composer:

```
composer require onurkacmaz/laravel-model-translate
```

```
php artisan vendor:publish --provider="Onurkacmaz\LaravelModelTranslate\LaravelModelTranslateServiceProvider" --tag=config
php artisan vendor:publish --provider="Onurkacmaz\LaravelModelTranslate\LaravelModelTranslateServiceProvider" --tag=migrations
```

```
php artisan migrate
```

Usage
-----

[](#usage)

### Trait

[](#trait)

```
use Onurkacmaz\LaravelModelTranslate\Traits\Translatable;

class Blog extends Model
{
    use Translatable;

    // You can define which fields will be translated
    public function getTranslatable(): array
    {
        return ['title', 'content'];
    }
}
```

### Class Based Usage

[](#class-based-usage)

```
use Onurkacmaz\LaravelModelTranslate\Traits\Translatable;

class TestController extends Controller
{
    public function index() {
        $translate = new LaravelModelTranslate();
        $translate->setColumns(['title', 'content']);
        $translate->setModel($blog);
        $translate->setLocale('en');
        $translate->translate();

        // or

        $translate = new LaravelModelTranslate($blog, ['title', 'content'], 'en');
        $translate->translate();
    }
}
```

### Static Usage

[](#static-usage)

```
use Onurkacmaz\LaravelModelTranslate\Traits\Translatable;

class TestController extends Controller
{
    public function index() {
        $translate = LaravelModelTranslate::make()
            ->setModel($account)
            ->setLocale('en')
            ->setColumns(['title', 'content'])
            ->translate();
    }
}
```

### Testing

[](#testing)

```
composer test
```

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)

- [Onur Kaçmaz](https://github.com/onurkacmaz)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

Laravel Package Boilerplate
---------------------------

[](#laravel-package-boilerplate)

This package was generated using the [Laravel Package Boilerplate](https://laravelpackageboilerplate.com).

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance59

Moderate activity, may be stable

Popularity9

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

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

1178d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9d45c0e88117cb94d44ba5788801e5f82cadf79ecd98d10f7d184cd9fe50f2f6?d=identicon)[onurkacmaz](/maintainers/onurkacmaz)

---

Tags

laraveltranslatetranslationmodelonurkacmazlaravel-model-translate

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/onurkacmaz-laravel-model-translate/health.svg)

```
[![Health](https://phpackages.com/badges/onurkacmaz-laravel-model-translate/health.svg)](https://phpackages.com/packages/onurkacmaz-laravel-model-translate)
```

PHPackages © 2026

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