Astrotomic/laravel-translatable
Astrotomic/laravel-translatable has 1,433 GitHub stars and 175 forks. GitHot measured -1 stars in 24 hours and +2 in 7 days. Last checked 2026-11-11 20:14 UTC. Last push 2026-11-02.
A Laravel package for multilingual models
Measured star growth
- in 24h
- -1
- in 7 days
- +2
- in 15 days
- Collecting history
- in 1 month
- Collecting history
Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.
README.md
OriginalIntroduction
If you want to store translations of your models into the database, this package is for you.
This is a Laravel package for translatable models. Its goal is to remove the complexity in retrieving and storing multilingual model instances. With this package you write less code, as the translations are being fetched/saved when you fetch/save your instance.
The full documentation can be found at GitBook.
Installation
composer require astrotomic/laravel-translatable
Quick Example
Getting translated attributes
$post = Post::first();
echo $post->translate('en')->title; // My first post
App::setLocale('en');
echo $post->title; // My first post
App::setLocale('de');
echo $post->title; // Mein erster Post
Saving translated attributes
$post = Post::first();
echo $post->translate('en')->title; // My first post
$post->translate('en')->title = 'My cool post';
$post->save();
$post = Post::first();
echo $post->translate('en')->title; // My cool post
Filling multiple translations
$data = [
'author' => 'Gummibeer',
'en' => ['title' => 'My first post'],
'fr' => ['title' => 'Mon premier post'],
];
$post = Post::create($data);
echo $post->translate('fr')->title; // Mon premier post
Filling multiple translations wrapped
You may define a wrapper property when creating new translations. Set the translations_wrapper property in translatable config file:
'translations_wrapper' => 'translations',
Then just wrap multiple locales using that property:
$data = [
'author' => 'Gummibeer',
'translations' => [
'en' => ['title' => 'My first post'],
'fr' => ['title' => 'Mon premier post'],
],
];
$post = Post::create($data);
echo $post->translate('fr')->title; // Mon premier post
Tutorials
- How To Add Multilingual Support to Eloquent
- How To Build An Efficient and SEO Friendly Multilingual Architecture For Your Laravel Application
- How to Add Multi-Language Models to Laravel QuickAdminPanel
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details. You could also be interested in CODE OF CONDUCT.
Security
If you discover any security related issues, please check SECURITY for steps to report it.
Credits
- Tom Witkowski current maintainer
- Dimitrios Savvopoulos original author
- David Llop refactoring testsuite
- Caneco artwork
- All Contributors
Versions
| Package | Laravel | PHP |
|---|---|---|
| v11.17 | 9.* / 10.* / 11.* / 12.* / 13.* |
^8.0 |
| v11.16 | 9.* / 10.* / 11.* / 12.* |
^8.0 |
| v11.13 - v11.15 | 9.* / 10.* / 11.* |
^8.0 |
| v11.12 - v11.12 | 8.* / 9.* / 10.* |
^8.0 |
| v11.10 - v11.11 | 8.* / 9.* |
^8.0 |
| v11.6 - v11.9 | 5.8.* / 6.* / 7.* / 8.* |
>=7.2 |
| v11.4 - v11.5 | 5.6.* / 5.7.* / 5.8.* / 6.* |
>=7.1.3 |
| v11.0 - v11.3 | 5.6.* / 5.7.* / 5.8.* |
>=7.1.3 |
Treeware
You're free to use this package, but if it makes it to your production environment I would highly appreciate you buying the world a tree.
It’s now common knowledge that one of the best tools to tackle the climate crisis and keep our temperatures from rising above 1.5C is to plant trees. If you contribute to my forest you’ll be creating employment for local families and restoring wildlife habitats.
You can buy trees at offset.earth/treeware
Read more about Treeware at treeware.earth
Explore related projects
Asabeneh/30-Days-Of-Python
The 30 Days of Python programming challenge is a step-by-step guide to learn the Python programming language in 30 days. This challenge may take more than 100 days. Follow your own pace. These videos may help too: https://www.youtube.com/channel/UC7PNRuno1rzYPb1xLa4yktw
78,560 starsgrafana/grafana
The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
77,830 starsredis/redis
For developers, who are building real-time data-driven applications, Redis is the preferred, fastest, and most feature-rich cache, data structure server, and document and vector query engine.
77,395 starsapache/superset
Apache Superset is a Data Visualization and Data Exploration Platform
75,473 stars