PHPackages                             hyperf/lazy-loader-incubator - 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. hyperf/lazy-loader-incubator

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

hyperf/lazy-loader-incubator
============================

v0.1.0(2y ago)06MITPHPPHP &gt;=8.1

Since Mar 6Pushed 2y ago2 watchersCompare

[ Source](https://github.com/hyperf/lazy-loader-incubator)[ Packagist](https://packagist.org/packages/hyperf/lazy-loader-incubator)[ Fund](https://hyperf.wiki/#/zh-cn/donate)[ Fund](https://opencollective.com/hyperf)[ RSS](/packages/hyperf-lazy-loader-incubator/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (8)Versions (2)Used By (0)

中文 | [English](./README-en.md)

Hyperf di 延迟加载
==============

[](#hyperf-di-延迟加载)

```
composer require hyperf/lazy-loader-incubator

```

发布配置文件
------

[](#发布配置文件)

```
php bin/hyperf vendor:publish hyperf/lazy-loader-incubator
```

使用
--

[](#使用)

```
// app/Service/UserInterface
interface UserInterface {
    public function work();
}
// app/Service/UserService
class UserService implements UserInterface{
    public function work()
    {
        return 'working...';
    }
}
```

```
// app/Controller/IndexController
namespace App\Controller;

use App\Service\UserInterface;
use Hyperf\Di\Annotation\Inject;

class IndexController {
    #[Inject(lazy: true)]
    private UserInterface $userService;

    public function index() {
        return $this->userService->work();
    }
}
```

生成延迟代理类为

```
// runtime/container/proxy/Hyperf_Lazy_UserService_xxx.php
namespace HyperfLazy\UserService;

/**
 * Be careful: This is a lazy proxy, not the real HyperfTest\Stub\FooService from container.
 *
 * {@inheritdoc}
 */
class Foo extends \App\Service\UserService
{
    use \Hyperf\Di\LazyLoader\LazyProxyTrait;
    const PROXY_TARGET = 'HyperfTest\\Stub\\FooService';
    public function work()
    {
        return $this->__call(__FUNCTION__, func_get_args());
    }
}
```

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity40

Maturing project, gaining track record

 Bus Factor1

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

Unknown

Total

1

Last Release

802d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/44228082?v=4)[Hyperf Community](/maintainers/hyperf)[@hyperf](https://github.com/hyperf)

---

Top Contributors

[![zds-s](https://avatars.githubusercontent.com/u/49744633?v=4)](https://github.com/zds-s "zds-s (7 commits)")[![limingxinleo](https://avatars.githubusercontent.com/u/16648551?v=4)](https://github.com/limingxinleo "limingxinleo (1 commits)")

---

Tags

phphyperf

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/hyperf-lazy-loader-incubator/health.svg)

```
[![Health](https://phpackages.com/badges/hyperf-lazy-loader-incubator/health.svg)](https://phpackages.com/packages/hyperf-lazy-loader-incubator)
```

PHPackages © 2026

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