PHPackages                             xiashaung/inject - 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. xiashaung/inject

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

xiashaung/inject
================

laravel attribute inject

0.2.0(2y ago)08MITPHPPHP &gt;=8.1

Since Jul 20Pushed 2y ago1 watchersCompare

[ Source](https://github.com/xiashaung/inject)[ Packagist](https://packagist.org/packages/xiashaung/inject)[ RSS](/packages/xiashaung-inject/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)DependenciesVersions (3)Used By (0)

说明
--

[](#说明)

```
1.  自动为路由组 web,api提供注入服务

```

其他文档
----

[](#其他文档)

- [登录校验](doc/login.md)

使用示例
----

[](#使用示例)

```
namespace App\Http\Controllers;

use Xiashaung\Inject\Attribute\Inject;
use App\Services\OrderService;
use Illuminate\Http\Request;

class TestController extends Controller
{
    #[Inject]
    //使用inject标注需要注入服务,OrderService 自动使用服务容器解析实例,如果 OrderService 里有静态方法 make ,自动调用
    protected OrderService $orderService;
```

其他方法使用
------

[](#其他方法使用)

```
//解析给定的类并为属性自动注入,返回实例
inject($classname,$args)->method()
```

其他路由组
-----

[](#其他路由组)

```
在AppServiceProvider的boot方法中添加

```

```
Route::pushMiddlewareToGroup('group_name', Xiashaung\Inject\Middleware\ControllerInject::class);
```

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity43

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

Total

2

Last Release

1028d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/94dfd5c1c238dc327dfd24ac1d20a7bb0317cc33a392b5921eadcb0b7ca712a1?d=identicon)[xiashaung](/maintainers/xiashaung)

---

Top Contributors

[![xiashaung](https://avatars.githubusercontent.com/u/19299786?v=4)](https://github.com/xiashaung "xiashaung (9 commits)")

### Embed Badge

![Health badge](/badges/xiashaung-inject/health.svg)

```
[![Health](https://phpackages.com/badges/xiashaung-inject/health.svg)](https://phpackages.com/packages/xiashaung-inject)
```

###  Alternatives

[enniosousa/server-error-pages

Laravel server-side error pages

175.6k](/packages/enniosousa-server-error-pages)

PHPackages © 2026

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