This is a simple dependency injection manager.
To install through composer, simply put the following in your composer.json
file:
{
"require": {
"ozziest/di": "dev-master"
}
}
$ composer update
class CustomModel {
public function __construct(IDB $db)
{
}
}
class MyController {
public function __construct(IModel $model, IRepository $repository, CustomModel $model)
{
}
}
Ozziest\DI::bind('IModel', 'MyModel');
Ozziest\DI::bind('IRepository', 'MyRepository');
Ozziest\DI::bind('IDB', 'MyDB');
$instance = Ozziest\DI::resolve('MyController');
// equals this
$instance = new MyController(
new MyModel(),
new MyRepository(),
new CustomModel(new MyDB())
);