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

ActiveLibrary

mindtwo/laravel-translatable
============================

This package is a Laravel extension for easy translation of model attributes, enabling seamless multi-language support in your application.

2.1.0(7mo ago)0111MITPHPPHP ^8.2||^8.3||^8.4CI passing

Since Jan 9Pushed 7mo ago5 watchersCompare

[ Source](https://github.com/mindtwo/laravel-translatable)[ Packagist](https://packagist.org/packages/mindtwo/laravel-translatable)[ Docs](https://github.com/mindtwo/laravel-translatable)[ GitHub Sponsors]()[ RSS](/packages/mindtwo-laravel-translatable/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (14)Versions (30)Used By (1)

Laravel Translatable Package
============================

[](#laravel-translatable-package)

[![Latest Version on Packagist](https://camo.githubusercontent.com/30def73ee7eab7ee49b028291e9c0f72e8f0895d6dee846e9797a292b575a7f6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d696e6474776f2f6c61726176656c2d7472616e736c617461626c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mindtwo/laravel-translatable)[![GitHub Tests Action Status](https://camo.githubusercontent.com/3371ed412570775c67722596e5be20d1bc9e8eedd081f6fc5bf328b51c48eb99/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6d696e6474776f2f6c61726176656c2d7472616e736c617461626c652f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/mindtwo/laravel-translatable/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/45c71436973d25a9c2a49c84ff72f6bfaa736e570e2ebb2eb06e284a26ba30c6/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6d696e6474776f2f6c61726176656c2d7472616e736c617461626c652f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/mindtwo/laravel-translatable/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/5e22fff2a0366a16d87f86d933ef8ccc27591ca159e4892742bd78e0d8574a8c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d696e6474776f2f6c61726176656c2d7472616e736c617461626c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mindtwo/laravel-translatable)

Overview
--------

[](#overview)

The `mindtwo/laravel-translatable` package provides a simple and effective way to manage multilingual models in a Laravel application. It allows you to easily translate Eloquent model attributes into multiple languages without the need for separate tables for each language.

Features
--------

[](#features)

- ✅ **Automatic Translation Override**: Translated fields automatically override base model attributes
- ✅ **Fallback Locale Support**: Uses Laravel's app locale and fallback locale
- ✅ **Query Scope Methods**: Search, filter, and order by translated content
- ✅ **Performance Optimized**: Efficient database queries with proper indexing
- ✅ **IDE Autocomplete**: Full PHPDoc support for all methods
- ✅ **Flexible Configuration**: Customizable locale resolution and auto-translation
- ✅ **Laravel Integration**: Works seamlessly with Eloquent relationships and collections

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

[](#installation)

To install the package, run the following command in your Laravel project:

```
composer require mindtwo/laravel-translatable
```

You can publish and run the migrations with:

```
php artisan vendor:publish --tag="translatable-migrations"
php artisan migrate
```

You can publish the config file with:

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

This is the contents of the published config file:

```
