digit-soft / re-action-di
React PHP framework DI
Installs: 11
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
pkg:composer/digit-soft/re-action-di
Requires
- php: >=7.0
- digit-soft/re-action: dev-master
- psr/container: ^1.0
This package is auto-updated.
Last update: 2021-05-28 09:30:37 UTC
README
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