PHPackages                             drhino/container - 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. [PSR &amp; Standards](/categories/psr-standards)
4. /
5. drhino/container

ActiveLibrary[PSR &amp; Standards](/categories/psr-standards)

drhino/container
================

Lightweight PSR-11 Container

v3.0.0(3y ago)038MITPHPPHP &gt;=7.4

Since Aug 3Pushed 3y ago1 watchersCompare

[ Source](https://github.com/drhino/container)[ Packagist](https://packagist.org/packages/drhino/container)[ Docs](https://github.com/drhino/container)[ RSS](/packages/drhino-container/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (6)Dependencies (3)Versions (7)Used By (0)

PSR-11: Container
=================

[](#psr-11-container)

Install with Composer:

```
composer require drhino/container:^3.0.0
```

Example use:
------------

[](#example-use)

```
class Dependency
{
    public string $var = '';
}

class Init
{
    public function __construct(Dependency $dependency, String $value)
    {
        $dependency->var = $value;
    }
}
```

```
$container = new drhino\Container\Container;

$container
    ->add(Init::class, [
        // The arguments of the constructor
        'dependency' => $container->ref(Dependency::class),
        'value'      => 'Hello world',
    ])
    ->add(Dependency::class)
;
```

> Use $container-&gt;ref() to reference an identifier before it has been added into the container.

```
// Executes __construct()
$init = $container->get(Init::class);

// Prints 'Hello world'
echo $container->get(Dependency::class)->var;
```

Signature:
----------

[](#signature)

The following are exactly the same:

```
$container->add(Dependency::class);
```

```
$container->add($id = Dependency::class, $resource = Dependency::class, $arguments = []);
```

```
$container->add($id = Dependency::class, $arguments = []);
```

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity51

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

Recently: every ~62 days

Total

6

Last Release

1134d ago

Major Versions

v1.1.0 → v2.0.02022-11-30

v2.1.0 → v3.0.02023-04-10

### Community

Maintainers

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

---

Top Contributors

[![drhino](https://avatars.githubusercontent.com/u/2538708?v=4)](https://github.com/drhino "drhino (44 commits)")

---

Tags

composer-librarycontainer-injectiondependency-injectiondependency-managerphpphp-librarypsr-11containerPSR-11dependency-injectiondependency manager

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Type Coverage Yes

### Embed Badge

![Health badge](/badges/drhino-container/health.svg)

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

###  Alternatives

[php-di/php-di

The dependency injection container for humans

2.8k48.9M994](/packages/php-di-php-di)[slince/di

A flexible dependency injection container

20260.4k6](/packages/slince-di)[phpwatch/simple-container

A fast and minimal PSR-11 compatible Dependency Injection Container with array-syntax and without auto-wiring

1810.1k2](/packages/phpwatch-simple-container)

PHPackages © 2026

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