PHPackages                             abdelhafz/trans-accessor - 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. abdelhafz/trans-accessor

ActiveLibrary

abdelhafz/trans-accessor
========================

simple model translate accessor that help save yor time and make you dry

24PHP

Since Feb 11Pushed 5y ago1 watchersCompare

[ Source](https://github.com/AbdelhafzDev/TransAccessor)[ Packagist](https://packagist.org/packages/abdelhafz/trans-accessor)[ RSS](/packages/abdelhafz-trans-accessor/feed)WikiDiscussions main Synced yesterday

READMEChangelogDependenciesVersions (1)Used By (0)

Trans Accessor
==============

[](#trans-accessor)

**Trans Accessor** allows us to simple accessors and return translate columns of an Eloquent model based on app localization. This gives us the ability to organize and reuse them on any model.

The problem
-----------

[](#the-problem)

in your project for example if you have a city model and in this model you have name\_en and name\_ar so every time your return data in front-end or mobile you need to check localization and show the correct one, a simple solution is to append a key and make accessor in this solution you need to repeat this in every model that has a localization keys; **Trans Accessor** aims at solving this limitation and save your time.

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

[](#installation)

The recommended way to install **Trans Accessor** is through [Composer](http://getcomposer.org/)

```
$ composer require abdelhafz/trans-accessor
```

The package will automatically register itself if you're using Laravel 5.5+. For Laravel 5.4, you'll have to register the package manually:

Usage
-----

[](#usage)

#### Defining accessors

[](#defining-accessors)

```
namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;

class City extends Model
{
    use HasFactory, \Abdelhafz\TransAccessor\Translatable;

    protected $translatable = ['name'];
}
```

```

## Authors

* [Abdelhafz](eng.abdelhafz@gmail.com) - *Initial work*

## License

**Trans Accessor** is licensed under the [MIT License](http://opensource.org/licenses/MIT).

```

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity31

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/6c270f4a14a67bc6fcfe3396316da4b5f3b6f99cc3a6314802a908cdfea66287?d=identicon)[Abdelhafz](/maintainers/Abdelhafz)

---

Top Contributors

[![AbdelhafzDev](https://avatars.githubusercontent.com/u/58186005?v=4)](https://github.com/AbdelhafzDev "AbdelhafzDev (6 commits)")

### Embed Badge

![Health badge](/badges/abdelhafz-trans-accessor/health.svg)

```
[![Health](https://phpackages.com/badges/abdelhafz-trans-accessor/health.svg)](https://phpackages.com/packages/abdelhafz-trans-accessor)
```

PHPackages © 2026

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