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 1w 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 35% of packages

Maintenance34

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity46

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

647d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/18556014?v=4)[知寂](/maintainers/YUCLing)[@YUCLing](https://github.com/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

[spatie/laravel-settings

Store your application settings

1.5k7.8M185](/packages/spatie-laravel-settings)[psalm/plugin-laravel

Psalm plugin for Laravel

3345.4M354](/packages/psalm-plugin-laravel)[fumeapp/modeltyper

Generate TypeScript interfaces from Laravel Models

199336.0k](/packages/fumeapp-modeltyper)[forjedio/inertia-table

Backend-driven dynamic tables for Laravel + Inertia.js

272.0k](/packages/forjedio-inertia-table)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

265.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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