hugoandrade/container-di

1.0.1 2024-08-01 15:10 UTC

This package is auto-updated.

Last update: 2024-09-01 15:20:41 UTC


README

Examples

$container = new DI;

//set a bind between a interface and a concrete class
$container->set(SomeInterface::class, ConcreteClass::class);

// retrieve a concrete class from interface
$instance = $container->get(SomeInterface::class);

$instance->doSomethingAwesome();

The get method, of DI container, will resolve automatically all dependencies of a class.