PHPackages                             msafadi/laravel-eloquent-l10n - 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. msafadi/laravel-eloquent-l10n

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

msafadi/laravel-eloquent-l10n
=============================

Laravel Eloquent Localization

v1.0.1(2y ago)8432[1 PRs](https://github.com/msafadi/laravel-eloquent-l10n/pulls)MITPHPPHP ^8.2

Since May 24Pushed 1y ago1 watchersCompare

[ Source](https://github.com/msafadi/laravel-eloquent-l10n)[ Packagist](https://packagist.org/packages/msafadi/laravel-eloquent-l10n)[ RSS](/packages/msafadi-laravel-eloquent-l10n/feed)WikiDiscussions main Synced 2d ago

READMEChangelog (2)Dependencies (8)Versions (3)Used By (0)

Laravel Eloquent Localization and Translation
=============================================

[](#laravel-eloquent-localization-and-translation)

In today's globalized world, reaching audiences across borders is more important than ever. To effectively engage users from diverse backgrounds, providing your website's content in their native language is crucial. However, managing content translations can be a complex and time-consuming process.

This is where the Laravel Eloquent Localization and Translation package comes in. It offers a comprehensive and developer-friendly solution to streamline your content translation workflow.

Challenges of Traditional Translation Management
------------------------------------------------

[](#challenges-of-traditional-translation-management)

- **Manual Processes:** Manually translating content across different pages and models can be tedious and error-prone.
- **Inconsistent Formatting:** Maintaining consistent formatting and style across translated content can be a significant challenge.
- **Limited Scalability:** As your website grows and you add more languages, managing translations can become increasingly difficult.

Features
--------

[](#features)

The Laravel Eloquent Localization and Translation package empowers you to:

- **Effortlessly Integrate Translations:** Integrate translation functionality into your Eloquent models with minimal code.
- **Choose Your Storage Approach:** Select the most suitable method for your project - dedicated translations tables for a structured approach or storing translations within model attributes for simpler scenarios.
- **Automatic Translation Loading:** Enjoy performance benefits with automatic eager loading of translations whenever models are retrieved.
- **Easy Access to Translated Attributes:** Access translated content through convenient methods directly on your model instances.
- **Artisan Command for Efficiency:** Leverage the artisan command to generate a starting point for your translations table migration, saving you development time.

By providing a flexible and developer-friendly solution, this package helps you efficiently manage content translations, ensuring a seamless experience for your global audience. This Laravel package empowers you to effortlessly manage translations for your Eloquent models. It offers two flexible approaches:

1. **Dedicated Translations Table:** This structured approach allows each model to have its own translations table, potentially including additional columns for specific needs.
2. **Model Attributes:** For simpler scenarios, translations can be stored directly as JSON within the model's attributes, providing a lightweight solution.

Installation
------------

[](#installation)

1. Install the package using Composer:

    ```
    composer require msafadi/laravel-eloquent-l10n
    ```
2. Optionally, you can publish the configuration file for customization:

    ```
    php artisan vendor:publish --provider="Safadi\Eloquent\L10n\EloquentL10nServiceProvider"
    ```
3. Add the package's service provider class `EloquentL10nServiceProvider` to the application's providers array

    - Laravel 11.x

    ```
