Download the PHP package rat.md/laravel-translatable without Composer
On this page you can find all versions of the php package rat.md/laravel-translatable. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download rat.md/laravel-translatable
More information about rat.md/laravel-translatable
Files in rat.md/laravel-translatable
Package laravel-translatable
Short Description Awesome translatable Laravel Eloquent models (for MySQL, MariaDB, PostgreSQL, SQLite & MongoDB).
License MIT
Homepage https://rat.md/laravel-translatable
Informations about the package laravel-translatable
rat.md/laravel-translatable
Most Laravel “translatable” packages force you to either convert your translatable attributes into a
JSON column on the same table (for storing all strings on one place), or requires you to create and
maintain a dedicated {model}_translations table for each model.
Both approaches work, but they either bloat your base table with JSON logic or force you to manage a growing number of nearly identical tables.
rat.md/laravel-translatable takes a different path — inspired by OctoberCMS — by using a
single, shared translations table for all your models.
Features
- Support for MySQL, MariaDB, PostgreSQL, SQlite and MongoDB (Driver-aware querying and sorting).
- One polymorphic translations table for everything — no extra migrations per model.
- Keep your default language clean in the model’s own columns, exactly where it belongs.
- Transparent reads and writes through the model’s attributes, with automatic fallback.
Requirements
- PHP ≥ 8.2
- Laravel ≥ 11
- SQLite ≥ 3.35 | MySQL ≥ 8.0 | MariaDB ≥ 10.6 | PostgreSQL ≥ 13.22
- Only required for MongoDB driver (experimental):
- MongoDB ≥ v7.0 (may work with ≥ v5.0 too)
- mongodb/laravel-mongodb ≥ 5.0
Installation
Install the package via composer:
Publish and run the migrations using:
Publish the configuration file with:
Usage
Preparing your models
Simply add the Translatable trait to your Eloquent models and declare which attributes should
support translations. Array-Like attributes must be declared either in your $casts or in the
package-native $translatableArrayAttributes model property.
Setting translations
Set translations in known / familiar ways.
Retrieving translations
Access translations directly, use helpers, or switch the application/model locale.
Querying by locale
Query, filter, and sort your models by translated values across different locales.
[!NOTE]
orderByLocale()is not yet supported for the MongoDB driver. We are actively exploring a clean and efficient implementation. For now, this scope works only with SQL drivers.
Testing
Changelog
Please see CHANGELOG for more information on what has changed recently.
License
Published under MIT License \ Copyright © 2024 - 2025 Sam @ rat.md
All versions of laravel-translatable with dependencies
illuminate/contracts Version ^11.0|^12.0|^13.0
illuminate/support Version ^11.0|^12.0|^13.0
illuminate/database Version ^11.0|^12.0|^13.0