{"id":13593374,"url":"https://github.com/Astrotomic/laravel-translatable","last_synced_at":"2025-04-09T02:33:19.805Z","repository":{"id":37432384,"uuid":"192333549","full_name":"Astrotomic/laravel-translatable","owner":"Astrotomic","description":"A Laravel package for multilingual models","archived":false,"fork":false,"pushed_at":"2024-10-07T08:17:50.000Z","size":3318,"stargazers_count":1245,"open_issues_count":27,"forks_count":157,"subscribers_count":20,"default_branch":"main","last_synced_at":"2024-10-29T15:05:13.163Z","etag":null,"topics":["database","eloquent","hacktoberfest","language","laravel","laravel-translatable","multilanguage","multilingual","multilingual-models","package","php","translated-attributes","translation","treeware"],"latest_commit_sha":null,"homepage":"https://docs.astrotomic.info/laravel-translatable/","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Astrotomic.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["Gummibeer","SarahSibert"],"issuehunt":"astrotomic","custom":["https://forest.astrotomic.info"]}},"created_at":"2019-06-17T11:27:13.000Z","updated_at":"2024-10-28T15:46:18.000Z","dependencies_parsed_at":"2022-07-14T07:10:34.579Z","dependency_job_id":"dcd81b38-9e63-4c24-885e-894a90217074","html_url":"https://github.com/Astrotomic/laravel-translatable","commit_stats":{"total_commits":950,"total_committers":90,"mean_commits":"10.555555555555555","dds":0.5526315789473684,"last_synced_commit":"0d065da7fb06b4b957afce79fdda159764561345"},"previous_names":[],"tags_count":75,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Astrotomic%2Flaravel-translatable","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Astrotomic%2Flaravel-translatable/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Astrotomic%2Flaravel-translatable/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Astrotomic%2Flaravel-translatable/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Astrotomic","download_url":"https://codeload.github.com/Astrotomic/laravel-translatable/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247112739,"owners_count":20885606,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["database","eloquent","hacktoberfest","language","laravel","laravel-translatable","multilanguage","multilingual","multilingual-models","package","php","translated-attributes","translation","treeware"],"created_at":"2024-08-01T16:01:19.743Z","updated_at":"2025-04-09T02:33:19.797Z","avatar_url":"https://github.com/Astrotomic.png","language":"PHP","funding_links":["https://github.com/sponsors/Gummibeer","https://github.com/sponsors/SarahSibert","https://issuehunt.io/r/astrotomic","https://forest.astrotomic.info"],"categories":["PHP"],"sub_categories":[],"readme":"# Introduction\n\n[![Latest Version](http://img.shields.io/packagist/v/astrotomic/laravel-translatable.svg?label=Release\u0026style=for-the-badge)](https://packagist.org/packages/astrotomic/laravel-translatable)\n[![MIT License](https://img.shields.io/github/license/Astrotomic/laravel-translatable.svg?label=License\u0026color=blue\u0026style=for-the-badge)](https://github.com/Astrotomic/laravel-translatable/blob/master/LICENSE)\n[![Offset Earth](https://img.shields.io/badge/Treeware-%F0%9F%8C%B3-green?style=for-the-badge)](https://plant.treeware.earth/Astrotomic/laravel-translatable)\n[![Larabelles](https://img.shields.io/badge/Larabelles-%F0%9F%A6%84-lightpink?style=for-the-badge)](https://www.larabelles.com/)\n\n[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/Astrotomic/laravel-translatable/phpunit.yml?style=flat-square\u0026logoColor=white\u0026logo=github\u0026label=PHPunit)](https://github.com/Astrotomic/laravel-translatable/actions?query=workflow%3Aphpunit)\n[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/Astrotomic/laravel-translatable/pint.yml?style=flat-square\u0026logoColor=white\u0026logo=github\u0026label=Pint)](https://github.com/Astrotomic/laravel-translatable/actions?query=workflow%3Apint)\n[![Codecov Coverage](https://img.shields.io/codecov/c/github/Astrotomic/laravel-translatable?logo=codecov\u0026logoColor=white\u0026label=Codecov\u0026style=flat-square)](https://codecov.io/gh/Astrotomic/laravel-translatable)\n[![Total Downloads](https://img.shields.io/packagist/dt/astrotomic/laravel-translatable.svg?label=Downloads\u0026style=flat-square)](https://packagist.org/packages/astrotomic/laravel-translatable)\n[![GitBook](https://img.shields.io/badge/GitBook-Astrotomic-7e57c2.svg?style=flat-square)](https://docs.astrotomic.info/laravel-translatable)\n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"/art/socialcard.png\" alt=\"laravel-translatable socialcard\"\u003e\n\u003c/p\u003e\n\n**If you want to store translations of your models into the database, this package is for you.**\n\nThis 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.\n\nThe full documentation can be found at [GitBook](https://docs.astrotomic.info/laravel-translatable).\n\n## Installation\n\n```bash\ncomposer require astrotomic/laravel-translatable\n```\n\n## Quick Example\n\n### **Getting translated attributes**\n\n```php\n$post = Post::first();\necho $post-\u003etranslate('en')-\u003etitle; // My first post\n\nApp::setLocale('en');\necho $post-\u003etitle; // My first post\n\nApp::setLocale('de');\necho $post-\u003etitle; // Mein erster Post\n```\n\n### **Saving translated attributes**\n\n```php\n$post = Post::first();\necho $post-\u003etranslate('en')-\u003etitle; // My first post\n\n$post-\u003etranslate('en')-\u003etitle = 'My cool post';\n$post-\u003esave();\n\n$post = Post::first();\necho $post-\u003etranslate('en')-\u003etitle; // My cool post\n```\n\n### **Filling multiple translations**\n\n```php\n$data = [\n  'author' =\u003e 'Gummibeer',\n  'en' =\u003e ['title' =\u003e 'My first post'],\n  'fr' =\u003e ['title' =\u003e 'Mon premier post'],\n];\n$post = Post::create($data);\n\necho $post-\u003etranslate('fr')-\u003etitle; // Mon premier post\n```\n\n#### Filling multiple translations wrapped\n\nYou may define a wrapper property when creating new translations. Set the `translations_wrapper` property in translatable config file:\n\n```php\n'translations_wrapper' =\u003e 'translations',\n```\n\nThen just wrap multiple locales using that property:\n\n```php\n$data = [\n  'author' =\u003e 'Gummibeer',\n  'translations' =\u003e [\n      'en' =\u003e ['title' =\u003e 'My first post'],\n      'fr' =\u003e ['title' =\u003e 'Mon premier post'],\n  ],\n];\n$post = Post::create($data);\n\necho $post-\u003etranslate('fr')-\u003etitle; // Mon premier post\n```\n\n## Tutorials\n\n- [How To Add Multilingual Support to Eloquent](https://laravel-news.com/how-to-add-multilingual-support-to-eloquent)\n- [How To Build An Efficient and SEO Friendly Multilingual Architecture For Your Laravel Application](https://mydnic.be/post/how-to-build-an-efficient-and-seo-friendly-multilingual-architecture-for-your-laravel-application)\n- [How to Add Multi-Language Models to Laravel QuickAdminPanel](https://quickadminpanel.com/blog/how-to-add-multi-language-models-to-laravel-quickadminpanel/)\n\n## Changelog\n\nPlease see [CHANGELOG](docs/changelog.md) for more information on what has changed recently.\n\n## Contributing\n\nPlease see [CONTRIBUTING](https://github.com/Astrotomic/.github/blob/master/CONTRIBUTING.md) for details. You could also be interested in [CODE OF CONDUCT](https://github.com/Astrotomic/.github/blob/master/CODE_OF_CONDUCT.md).\n\n### Security\n\nIf you discover any security related issues, please check [SECURITY](https://github.com/Astrotomic/.github/blob/master/SECURITY.md) for steps to report it.\n\n## Credits\n\n- [Tom Witkowski](https://github.com/Gummibeer) _current maintainer_\n- [Dimitrios Savvopoulos](https://github.com/dimsav) _original author_\n- [David Llop](https://github.com/Lloople) _refactoring testsuite_\n- [Caneco](https://github.com/caneco) _artwork_\n- [All Contributors](../../contributors)\n\n## Versions\n\n| Package             | Laravel                       | PHP       |\n| :------------------ | :---------------------------- | :-------- |\n| **v11.16**          | `9.* / 10.* / 11.* / 12.*`    | `^8.0`    |\n| **v11.13 - v11.15** | `9.* / 10.* / 11.*`           | `^8.0`    |\n| **v11.12 - v11.12** | `8.* / 9.* / 10.*`            | `^8.0`    |\n| **v11.10 - v11.11** | `8.* / 9.*`                   | `^8.0`    |\n| **v11.6 - v11.9**   | `5.8.* / 6.* / 7.* / 8.*`     | `\u003e=7.2`   |\n| **v11.4 - v11.5**   | `5.6.* / 5.7.* / 5.8.* / 6.*` | `\u003e=7.1.3` |\n| **v11.0 - v11.3**   | `5.6.* / 5.7.* / 5.8.*`       | `\u003e=7.1.3` |\n\n## Treeware\n\nYou'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.\n\nIt’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](https://www.bbc.co.uk/news/science-environment-48870920). If you contribute to my forest you’ll be creating employment for local families and restoring wildlife habitats.\n\nYou can buy trees at [offset.earth/treeware](https://plant.treeware.earth/Astrotomic/laravel-translatable)\n\nRead more about Treeware at [treeware.earth](https://treeware.earth)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAstrotomic%2Flaravel-translatable","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FAstrotomic%2Flaravel-translatable","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAstrotomic%2Flaravel-translatable/lists"}