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

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

aheenam/laravel-translatable
============================

A Laravel Package to manage translations for models simply using a Trait

2.0.0(7y ago)448MITPHPPHP ^7.2

Since Jan 30Pushed 7y ago1 watchersCompare

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

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

A Trait to handle Translations in Laravel
=========================================

[](#a-trait-to-handle-translations-in-laravel)

This is a Laravel package containing a trait for translatable Eloquent models. This package follows the approach to have only a single table to maintain all the translations.

This approach may not be perfect for every use case as the table can grow really big. But compared to all the other packages this approach is the most flexible as it lets you make models and its attributes translatable without extra configuration.

Alternatives to this package are following packages:

1. [Spatie/laravel-translatable](https://github.com/spatie/laravel-translatable) saves the translatable attributes as jsons
2. [dimsav/laravel-translatable](https://github.com/dimsav/laravel-translatable) expects a new table for every new model that has translatable attributes

Requirements
------------

[](#requirements)

This package require a minimum Laravel version of `5.7` and PHP in version `7.2`

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

[](#installation)

You can install the package via composer:

```
composer require aheenam/laravel-translatable
```

Now you can use this Trait on any Eloquent Model of your project.

Usage
-----

[](#usage)

To make your Eloquent Model translatable just add the `Aheenam\Translatable\Translatable` Trait to your model. Then add a public attribute `$translatable` as an array containing all the attributes that should be translatable.

```
