PHPackages                             narokishi/lightweight-di - 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. [Framework](/categories/framework)
4. /
5. narokishi/lightweight-di

ActiveLibrary[Framework](/categories/framework)

narokishi/lightweight-di
========================

Lightweight dependency injection with lazy load for PHP applications

v1.0.1(6y ago)2201MITPHPPHP &gt;=7.1.0CI failing

Since Mar 27Pushed 6y agoCompare

[ Source](https://github.com/narokishi/lightweight-di)[ Packagist](https://packagist.org/packages/narokishi/lightweight-di)[ RSS](/packages/narokishi-lightweight-di/feed)WikiDiscussions master Synced 2w ago

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

Lightweight Dependency Injection
================================

[](#lightweight-dependency-injection)

BuildCoverageDownloadsReleaseLicense[![Build Status](https://camo.githubusercontent.com/5154281ade68b399b9d2902f35099a505b6b11ee27414f51d90adbc3c48f9779/68747470733a2f2f7472617669732d63692e636f6d2f6e61726f6b697368692f6c696768747765696768742d64692e7376673f6272616e63683d6d61737465722676657273696f6e3d312e302e30)](https://travis-ci.com/narokishi/lightweight-di)[![Coverage Status](https://camo.githubusercontent.com/fed0171820a1c93c5814f23e5c0ea8b74242539d6a60f1a1c2199188858333da/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f6e61726f6b697368692f6c696768747765696768742d64692f62616467652e7376673f6272616e63683d6d617374657226736572766963653d6769746875622676657273696f6e3d312e302e30)](https://coveralls.io/github/narokishi/lightweight-di?branch=master)[![Total Downloads](https://camo.githubusercontent.com/60aacc073c9e098c8fa53c272b6191769da597d86ac885e250a2480f6be87655/68747470733a2f2f706f7365722e707567782e6f72672f6e61726f6b697368692f6c696768747765696768742d64692f646f776e6c6f6164733f76657273696f6e3d312e302e30)](https://packagist.org/packages/narokishi/lightweight-di)[![Latest Stable Version](https://camo.githubusercontent.com/63e6cb4aab74b0b3bbd80aff5bcf51ec5f2467565583e4f50b911cb68602ceb8/68747470733a2f2f706f7365722e707567782e6f72672f6e61726f6b697368692f6c696768747765696768742d64692f762f737461626c653f76657273696f6e3d312e302e30)](https://packagist.org/packages/narokishi/lightweight-di)[![License](https://camo.githubusercontent.com/11dc6edc34c0222b4497ec39bb3e40032c45c6ce3303c1f5b8246344d33983ea/68747470733a2f2f706f7365722e707567782e6f72672f6e61726f6b697368692f6c696768747765696768742d64692f6c6963656e73653f76657273696f6e3d312e302e30)](https://packagist.org/packages/narokishi/lightweight-di)Description
-----------

[](#description)

"Lightweight Dependency Injection" is a **PHP** package, which allows to inject your dependencies within services. It builds only required classes for the current request.

Installation
------------

[](#installation)

### Composer

[](#composer)

Installing via [Composer](https://getcomposer.org/download/) will keep this package up to date for you.

```
composer require narokishi/lightweight-di
```

### Usage

[](#usage)

```
use Narokishi\DependencyInjection\Container;

...

$container = new Container;
$container->registerService(ExampleService::class, function () {
    return new ExampleService(
        ...constructorArgs
    );
});
$container->registerService(SecondExampleService::class, function (Container $container) {
    return new SecondExampleService(
        $container->getService(ExampleService::class)
    );
});

...

$secondExampleService = $container->getService(SecondExampleService::class);
```

Contributing
------------

[](#contributing)

Thank you for considering contributing to the package.

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 85.7% 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 ~418 days

Total

2

Last Release

2232d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/37650356?v=4)[Tomasz Motyl](/maintainers/Narokishi)[@narokishi](https://github.com/narokishi)

---

Top Contributors

[![narokishi](https://avatars.githubusercontent.com/u/37650356?v=4)](https://github.com/narokishi "narokishi (6 commits)")[![peter279k](https://avatars.githubusercontent.com/u/9021747?v=4)](https://github.com/peter279k "peter279k (1 commits)")

---

Tags

phpdependency-injectionlightweight-dilazy-load-di

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/narokishi-lightweight-di/health.svg)

```
[![Health](https://phpackages.com/badges/narokishi-lightweight-di/health.svg)](https://phpackages.com/packages/narokishi-lightweight-di)
```

###  Alternatives

[pestphp/pest-plugin-stressless

Stressless plugin for Pest

68943.9k18](/packages/pestphp-pest-plugin-stressless)

PHPackages © 2026

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