PHPackages                             barisdemirhan/laravel-polyglot-model - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. barisdemirhan/laravel-polyglot-model

ActiveLibrary[Database &amp; ORM](/categories/database)

barisdemirhan/laravel-polyglot-model
====================================

Elegant model translations for Laravel with polymorphic storage and eager loading support

v1.0.0(5mo ago)037MITPHPPHP ^8.1CI failing

Since Jan 20Pushed 1mo agoCompare

[ Source](https://github.com/barisdemirhan/laravel-polyglot-model)[ Packagist](https://packagist.org/packages/barisdemirhan/laravel-polyglot-model)[ Docs](https://github.com/barisdemirhan/laravel-polyglot-model)[ RSS](/packages/barisdemirhan-laravel-polyglot-model/feed)WikiDiscussions main Synced today

READMEChangelog (1)Dependencies (5)Versions (2)Used By (0)

Laravel Polyglot Model
======================

[](#laravel-polyglot-model)

[![Latest Version on Packagist](https://camo.githubusercontent.com/381508e5fe171fe817f9745f966db1aa2edef15afb1989bfce61e2d5942b4cb9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f626172697364656d697268616e2f6c61726176656c2d706f6c79676c6f742d6d6f64656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/barisdemirhan/laravel-polyglot-model)[![GitHub Tests Action Status](https://camo.githubusercontent.com/bebfcb6f7921576850c4bc5452a9a551b214d562f48983f3b1912d1f1edd46bb/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f626172697364656d697268616e2f6c61726176656c2d706f6c79676c6f742d6d6f64656c2f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/barisdemirhan/laravel-polyglot-model/actions?query=workflow%3A%22Run+Tests%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/05ae505c3d08f1c5ce29995051e48d6273664e5c5310764dcc7539cab7caed85/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f626172697364656d697268616e2f6c61726176656c2d706f6c79676c6f742d6d6f64656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/barisdemirhan/laravel-polyglot-model)[![License](https://camo.githubusercontent.com/c60ffa078b6abe4f30f757e22aab7d0b35ce8268d7f7b95ab6b00241ca7d0bf4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f626172697364656d697268616e2f6c61726176656c2d706f6c79676c6f742d6d6f64656c2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)

**Elegant model translations for Laravel with polymorphic storage and eager loading support.**

[Documentation](https://barisdemirhan.github.io/laravel-polyglot-model) · [Report Bug](https://github.com/barisdemirhan/laravel-polyglot-model/issues) · [Request Feature](https://github.com/barisdemirhan/laravel-polyglot-model/issues)

---

✨ Features
----------

[](#-features)

- 🚀 **Simple API** - Intuitive trait-based approach
- 🔄 **Polymorphic Storage** - Single translations table for all models
- ⚡ **Eager Loading** - Optimized for performance with relationship loading
- 🎯 **Magic Getters** - Access translations like regular attributes
- 🔍 **Query Scopes** - Search across translated fields
- 💾 **Caching** - Built-in cache support for better performance
- 🎭 **Events** - Hooks for translation create/update/delete

📋 Requirements
--------------

[](#-requirements)

- PHP 8.1+
- Laravel 10.x, 11.x, or 12.x

📦 Installation
--------------

[](#-installation)

```
composer require barisdemirhan/laravel-polyglot-model
```

Publish and run migrations:

```
php artisan vendor:publish --tag="polyglot-model-migrations"
php artisan migrate
```

Optionally publish the config file:

```
php artisan vendor:publish --tag="polyglot-model-config"
```

🚀 Quick Start
-------------

[](#-quick-start)

### 1. Add the trait to your model

[](#1-add-the-trait-to-your-model)

```
