DiMaria Dependency Injector
, (*1)
DiMaria is a Dependency Injection Container for PHP 7+ with no dependencies. It's written to be extremely fast and lightweight., (*2)
Installation
Fetch DiMaria with composer via packagist. Add it with, (*3)
composer require dangerousdan/dimaria
Usage
DiMaria should work out of the box. Just call get() with the class name you wish to create., (*4)
$di = new DD\DiMaria;
$object = $di->get('ClassName');
DiMaria implements the PSR7 Container interface., (*5)
DiMaria can:
* Automatically fetch type-hinted dependencies in classes
* Set and override parameters and create aliases
* Set preferences for interfaces or classes
* Configure classes to return shared or new instances
* Support variadic parameters
* Configure Setter injection, (*6)
For more info, see the docs, (*7)
, (*8)