PHPackages                             rain-plus/eloquent-inject-attribute - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. rain-plus/eloquent-inject-attribute

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

rain-plus/eloquent-inject-attribute
===================================

A helper class that injects attributes to Eloquent model.

1.0.1(1y ago)09MITPHPPHP ^8.0

Since Oct 31Pushed 1y ago1 watchersCompare

[ Source](https://github.com/YUCLing/eloquent-attribute-inject)[ Packagist](https://packagist.org/packages/rain-plus/eloquent-inject-attribute)[ RSS](/packages/rain-plus-eloquent-inject-attribute/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (1)Versions (3)Used By (0)

A helper class that can be used to inject attributes into an Eloquent model without having to modify the model.

This class cannot inject default values to models that weren't created by Eloquent (like using `new static`). But still can trigger the save event. You will have to handle this by yourself.

Example

```
(new InjectModelAttribute(User::class))
    ->attribute('money', function(User $user) use ($economy) {
        return $economy->getMoney($user);
    }, function (User $user, $name, $value) use ($economy) {
        $originalMoney = $economy->getMoney($user);
        $delta = $value - $originalMoney;
        $economy->addMoney($user, $delta);
    });

// Then you can do...
$money = $user->money;
$user->money = $money + 100;
```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance38

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 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.

###  Release Activity

Cadence

Every ~8 days

Total

2

Last Release

548d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7400f6dbc11c980273adb0a146346df2715b6b856d6fd46fdd3cbe1c43c61818?d=identicon)[YUCLing](/maintainers/YUCLing)

---

Top Contributors

[![YUCLing](https://avatars.githubusercontent.com/u/18556014?v=4)](https://github.com/YUCLing "YUCLing (3 commits)")

---

Tags

helpermodelinjectflarum

### Embed Badge

![Health badge](/badges/rain-plus-eloquent-inject-attribute/health.svg)

```
[![Health](https://phpackages.com/badges/rain-plus-eloquent-inject-attribute/health.svg)](https://phpackages.com/packages/rain-plus-eloquent-inject-attribute)
```

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M687](/packages/barryvdh-laravel-ide-helper)[mpociot/reanimate

Undo Laravel soft deletes

1221.2k](/packages/mpociot-reanimate)

PHPackages © 2026

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