DI is a simple dependency injection manager.

1.0.1 2016-05-30 06:56 UTC

This package is not auto-updated.

Last update: 2024-07-06 18:17:44 UTC


Dependency Injection Resolver

Build Status Total Downloads Latest Stable Version Latest Unstable Version License

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())