PHPackages                             walnut/lib\_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. walnut/lib\_container

ActiveLibrary

walnut/lib\_container
=====================

070PHP

Since Jan 21Pushed 2y ago1 watchersCompare

[ Source](https://github.com/kapitancho/walnut-lib-container)[ Packagist](https://packagist.org/packages/walnut/lib_container)[ RSS](/packages/walnut-lib-container/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependenciesVersions (1)Used By (0)

PSR-11 compatible container interface
=====================================

[](#psr-11-compatible-container-interface)

A very easy to use DI-container implementation.

Example:
--------

[](#example)

```
final class DbUserRepository implements UserRepository {
    public function __construct(
        private /*readonly*/ QueryExecutor $queryExecutor
    ) {}
    //...
}

$mapping = [
    UserRepository::class => DbUserRepository::class,
    QueryExecutor::class => PdoQueryExecutor::class,
    PdoQueryExecutor::class => [
        'dsn' => 'mysql:host=localhost;dbname=demo',
        'user' => 'root',
        'pwd' => 'root'
    ],
    UserService::class => fn(UserRepository $userRepository)
        => new UserService($userRepository, [
            'tokenValidityInMinutes' => 180
        ]
    ),
    LoggerInterface::class => FileLogger::class,
    FileLogger::class => LocalFileLogger::class
];
$container = new ContainerAdapter(new Container($mapping));
$container->get(UserService::class); //returns UserService with injected DbUserRepository
$container->get(LoggerInterface::class); //returns LocalFileLogger
```

###  Health Score

14

—

LowBetter than 2% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity19

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/12d2910601119ce65c373b7e21ffc647154bde10c5ad0a0598ab1143aa851701?d=identicon)[kapitancho](/maintainers/kapitancho)

---

Top Contributors

[![kapitancho](https://avatars.githubusercontent.com/u/792682?v=4)](https://github.com/kapitancho "kapitancho (7 commits)")

### Embed Badge

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

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

PHPackages © 2026

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