Another dependency injection container

dev-master 2015-05-30 08:32 UTC

This package is not auto-updated.

Last update: 2024-04-27 15:25:58 UTC


README

Another dependency injection container

Build status Test coverage

Services

Register services using set and providing an identifier and a factory

$application->set('service', function () {
    return new stdClass();
});

Access the service anywhere in your application

$service = $application->service;

If you want to share the same instance across your application use share

$application->share('service', function () {
    return new stdClass();
});

You can provide arguments for your services

$application->set('person', function ($name) {
    $person = new stdClass();
    $person->name = $name;
    
    return $person;
});

$person = $application->person('Marco');