LaravelPackages.net
Acme Inc.
Toggle sidebar
nevadskiy/laravel-translatable

Add translations to your Eloquent models

22.213
21
0.10.0
About nevadskiy/laravel-translatable

nevadskiy/laravel-translatable is a Laravel package for add translations to your eloquent models. It currently has 21 GitHub stars and 22.213 downloads on Packagist (latest version 0.10.0). Install it with composer require nevadskiy/laravel-translatable. Discover more Laravel packages by nevadskiy or browse all Laravel packages to compare alternatives.

Last updated

Add translations to your Eloquent models

PHPUnit Code Coverage Latest Stable Version License

Stand With Ukraine

๐Ÿฌ Features

  • Translatable attributes behave like regular model attributes.
  • Full support for accessors, mutators and casts (even JSON).
  • Fallback translations.
  • 4 different strategies for storing translations.

๐Ÿ“บ Quick demo

$book = new Book()
$book->translator()->set('title', 'Fifty miles', 'en')
$book->translator()->set('title', "ะŸ'ัั‚ะดะตััั‚ ะฒะตั€ัั‚ะพะฒ", 'uk')
$book->save();

app()->setLocale('en');
echo $book->title; // Fifty miles

app()->setLocale('uk');
echo $book->title; // ะŸ'ัั‚ะดะตััั‚ ะฒะตั€ัั‚ะพะฒ

โœ… Requirements

  • PHP 7.2 or newer
  • Laravel 7.0 or newer
  • Can work with Octane

๐Ÿ”Œ Installation

Install the package via composer:

composer require nevadskiy/laravel-translatable

๐Ÿ“‘ Documentation

Documentation for the package can be found in the Wiki section.

๐Ÿ“„ Changelog

Please see CHANGELOG for more information what has changed recently.

โ˜• Contributing

Thank you for considering contributing. Please see CONTRIBUTING for more information.

๐Ÿ“œ License

The MIT License (MIT). Please see LICENSE for more information.

Star History Chart