PHPackages                             vdauchy/laravel-model-injector - 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. vdauchy/laravel-model-injector

ActiveLibrary

vdauchy/laravel-model-injector
==============================

0.2.0(5y ago)065MITPHPPHP ^7.4|^8.0

Since Feb 4Pushed 5y ago1 watchersCompare

[ Source](https://github.com/vdauchy/laravel-model-injector)[ Packagist](https://packagist.org/packages/vdauchy/laravel-model-injector)[ RSS](/packages/vdauchy-laravel-model-injector/feed)WikiDiscussions develop Synced today

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

**Laravel Model Injector**

This package is a simple trait to help on Model Injection.

The main goal is to replace class set in config as in [laravel-permission](https://github.com/spatie/laravel-permission/blob/master/config/permission.php):

```
// In: config/permission.php
return [
    'models' => [
        'permission' => Permission::class,
        'role' => Role::class,
    ],
    ...
];

// In: src/PermissionRegistrar.php
public function __construct(CacheManager $cacheManager)
{
    $this->permissionClass = config('permission.models.permission');
    $this->roleClass = config('permission.models.role');
    ...
}
```

And instead do:

```
// In: src/PermissionRegistrar.php

use HasModelInjection;

public function __construct(CacheManager $cacheManager)
{
    $this->permissionClass = $this->mClass(Permission::class);
    $this->roleClass = $this->mClass(Role::class);
    ...
}
```

To use their own class, any developer can do:

```
$this->app->bind(Permission::class, MyCustomPermission::class);
```

**Current API:**

`mQuery(string $model): Builder`: Let you build a query against this Model.

`mNew(string $model, array $attributes = []): Model`: Let you create a new instance of this Model.

`mClass(string $model): string`: Return the class associated to the Model.

`mTable(string $model): string`: Return the table's name of the Model".

`mColumns(string $model): Collection`: Return a Collection of columns.

###  Health Score

23

—

LowBetter than 30% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity48

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 ~44 days

Total

2

Last Release

1828d ago

PHP version history (2 changes)0.1.0PHP ^7.4

0.2.0PHP ^7.4|^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/a70faaa292ccf8df691bd07c64832c6572c64b1bda53200975fddc3e0dcfebdf?d=identicon)[vdauchy](/maintainers/vdauchy)

---

Top Contributors

[![vdauchy](https://avatars.githubusercontent.com/u/26772554?v=4)](https://github.com/vdauchy "vdauchy (2 commits)")

### Embed Badge

![Health badge](/badges/vdauchy-laravel-model-injector/health.svg)

```
[![Health](https://phpackages.com/badges/vdauchy-laravel-model-injector/health.svg)](https://phpackages.com/packages/vdauchy-laravel-model-injector)
```

###  Alternatives

[rtconner/laravel-likeable

Trait for Laravel Eloquent models to allow easy implementation of a 'like' or 'favorite' or 'remember' feature.

402385.8k5](/packages/rtconner-laravel-likeable)[naoray/eloquent-model-analyzer

Helpful methods to gain more information about eloquent model classes.

16429.8k1](/packages/naoray-eloquent-model-analyzer)[qlick/laravel-full-calendar

Laravel helper for FullCalendar.io. Fork of https://github.com/maddhatter/laravel-fullcalendar

1345.5k](/packages/qlick-laravel-full-calendar)[bjorn-voesten/ciphersweet-for-laravel

1611.6k](/packages/bjorn-voesten-ciphersweet-for-laravel)[aedart/athenaeum

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

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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