Skip to content

Dependency injection container for Re-action framework

License

Notifications You must be signed in to change notification settings

digit-soft/re-action-di

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Re-action DI

Dependency injection container for re-action framework

Usage

//Creation
$container = new \Reaction\DI\Container([
    'definitions' => [
        'componentId' => [
            'class' => 'Component\Class\Path',
            'property_1' => 1,
            'property_2' => InstanceOf('Component\Class\Path2'),
        ],
        //Alias
        'componentAlias' => 'componentId',
    ],
    'singletons' => [
        'componentId2' => 'componentId2',
    ],
]);
//Set entry
$container->set('component', ['class' => '...'], [...]);
//Get entry
$cmp  = $container->get('componentId');
//Singletons
$cmp2 = $container->get('componentId2');
$cmp3 = $container->get('componentId2');
echo $cmp2 === $cmp3; //TRUE

About

Dependency injection container for Re-action framework

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages