nevadskiy / laravel-translatable
Add translations to your Eloquent models
0.9.0
2024-04-04 21:50 UTC
Requires
- php: ^7.2|^8.0
- laravel/framework: ^7.0|^8.0|^9.0|^10.0|^11.0
Requires (Dev)
- mockery/mockery: ^1.2
- orchestra/testbench: ^5.0|^6.0|^7.0|^8.0|^9.0
- phpunit/phpunit: ^8.0|^9.0|^10.5
README
๐ฌ 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.