Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/mqwerty/dependency-injection

Simple PSR-11 DI container with autowiring
https://github.com/mqwerty/dependency-injection

dependency-injection php psr-11

Last synced: about 22 hours ago
JSON representation

Simple PSR-11 DI container with autowiring

Awesome Lists containing this project

README

        

[![Test](https://github.com/mqwerty/dependency-injection/workflows/Test/badge.svg)](https://github.com/mqwerty/dependency-injection/actions?query=workflow%3ATest)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=mqwerty_dependency-injection&metric=alert_status)](https://sonarcloud.io/dashboard?id=mqwerty_dependency-injection)
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=mqwerty_dependency-injection&metric=coverage)](https://sonarcloud.io/dashboard?id=mqwerty_dependency-injection)
[![Minimum PHP Version](https://img.shields.io/packagist/php-v/mqwerty/dependency-injection)](https://php.net/)
[![Latest Stable Version](https://img.shields.io/packagist/v/mqwerty/dependency-injection)](https://packagist.org/packages/mqwerty/dependency-injection)

Simple PSR-11 DI container with autowiring

```php
'info',
'shared' => [LoggerInterface::class],
LoggerInterface::class => fn($c) => (new Logger('log'))->pushHandler(
new StreamHandler(STDERR, $c->get('logLevel'))
),
];

$container = new Mqwerty\DI\Container($config);
$container->get(Foo::class);
```