PHPackages                             m-r-r/lazy-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. [Utility &amp; Helpers](/categories/utility)
4. /
5. m-r-r/lazy-container

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

m-r-r/lazy-container
====================

Smallest possible Dependency Injection container

v0.1.0(11y ago)217BSD-3-ClausePHPPHP &gt;=5.5

Since Sep 21Pushed 11y ago1 watchersCompare

[ Source](https://github.com/m-r-r/LazyContainer)[ Packagist](https://packagist.org/packages/m-r-r/lazy-container)[ RSS](/packages/m-r-r-lazy-container/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (3)Used By (0)

Lazy Container
==============

[](#lazy-container)

Usage
-----

[](#usage)

```
require __DIR__ . '/vendor/autoload.php';

use LazyContainer\Container;

class Foo
{
    public $name;

    function __construct($name)
    {
        echo "Instance of Foo created with name \"$name\".\n";
    }
}

class Bar
{
    public $foo;
    function __construct(Container $c)
    {
        echo "Instance of Bar created.\n";
        $this->foo = $c->foo;
    }
}

class Baz
{
    public $foo;
    public $bar;

    function __construct(Container $c)
    {
        echo "Instance of Baz created.\n";
        $this->bar = $c->bar;
        $this->foo = $c->foo;
    }
}

$cont = new Container;

$cont->foo = function($self, $cfg) {
    return new Foo($self->fooName);
};

$cont->bar = function($self) {
    return new Bar($self);
};

$cont->baz = function($self) {
    return new Baz($self);
};

$cont->fooName = 'Quux';

// Later:
var_dump($cont->baz instanceOf Baz
         && $cont->baz->bar === $cont->bar
         && $cont->baz->foo === $cont->bar->foo);
```

This program would print:

```
Instance of Baz created.
Instance of Bar created.
Instance of Foo created with name "Quux".
bool(true)

```

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity49

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

4251d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5690ff2978d396cda140f6f3fd047efae2e2f46c5e0158d1685d09586b212515?d=identicon)[m-r-r](/maintainers/m-r-r)

---

Top Contributors

[![m-r-r](https://avatars.githubusercontent.com/u/1268110?v=4)](https://github.com/m-r-r "m-r-r (2 commits)")

### Embed Badge

![Health badge](/badges/m-r-r-lazy-container/health.svg)

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

###  Alternatives

[vinkius-labs/laravel-page-speed

Laravel Page Speed

2.5k5.4k1](/packages/vinkius-labs-laravel-page-speed)

PHPackages © 2026

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