PHPackages                             afzaal565/field-translations - 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. [Localization &amp; i18n](/categories/localization)
4. /
5. afzaal565/field-translations

ActiveLibrary[Localization &amp; i18n](/categories/localization)

afzaal565/field-translations
============================

Laravel package for multilingual field translations via polymorphic relations

1.0.0(1y ago)48PHP

Since Oct 26Pushed 1y ago1 watchersCompare

[ Source](https://github.com/Afzaal565/DB-Fields-Translations)[ Packagist](https://packagist.org/packages/afzaal565/field-translations)[ RSS](/packages/afzaal565-field-translations/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (2)Used By (0)

DB Fields Translations
======================

[](#db-fields-translations)

A Laravel package for managing field translations in your database tables using polymorphic relations.

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

[](#installation)

You can install the package via composer:

```
composer require afzaal565/field-translations
```

Configuration
-------------

[](#configuration)

Publish the configuration file:

```
php artisan vendor:publish --provider="FieldTranslations\Providers\FieldTranslationProvider"
```

This will create a `field-translations.php` config file in your config directory.

Usage
-----

[](#usage)

### 1. Add the Trait to Your Model

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

```
use FieldTranslations\Traits\HasTranslations;

class YourModel extends Model
{
    use HasTranslations;

    protected $translatable = [
        'title',
        'description',
        // Add your translatable fields here
    ];
}
```

### 2. Create Translation Tables

[](#2-create-translation-tables)

Run the migrations:

```
php artisan migrate
```

### 3. Working with Translations

[](#3-working-with-translations)

```
// Set translations
$model->setTranslation('title', 'en', 'English Title');
$model->setTranslation('title', 'es', 'Spanish Title');

// Get translations
$model->getTranslation('title', 'en'); // Returns: English Title
$model->getTranslation('title', 'es'); // Returns: Spanish Title

// Get all translations for a field
$model->getTranslations('title'); // Returns array of all translations

// Check if translation exists
$model->hasTranslation('title', 'en'); // Returns boolean
```

Features
--------

[](#features)

- Easy to integrate with any Laravel model
- Support for multiple languages
- Automatic translation table creation
- Flexible configuration options
- Cache support for better performance

Configuration Options
---------------------

[](#configuration-options)

In your `config/field-translations.php` file, you can configure:

- Default language
- Available languages
- Cache settings
- Table naming conventions

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance42

Moderate activity, may be stable

Popularity9

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity39

Early-stage or recently created project

 Bus Factor1

Top contributor holds 50.9% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

617d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/98333630?v=4)[Afzaal565](/maintainers/Afzaal565)[@Afzaal565](https://github.com/Afzaal565)

---

Top Contributors

[![Afzaal-Botsify](https://avatars.githubusercontent.com/u/201547460?v=4)](https://github.com/Afzaal-Botsify "Afzaal-Botsify (28 commits)")[![Afzaal565](https://avatars.githubusercontent.com/u/98333630?v=4)](https://github.com/Afzaal565 "Afzaal565 (27 commits)")

### Embed Badge

![Health badge](/badges/afzaal565-field-translations/health.svg)

```
[![Health](https://phpackages.com/badges/afzaal565-field-translations/health.svg)](https://phpackages.com/packages/afzaal565-field-translations)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
