Skip to content

Commit

Permalink
Add README
Browse files Browse the repository at this point in the history
  • Loading branch information
digitv committed Jul 11, 2018
1 parent 7c9e0cd commit 2e1b46e
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Re-action DI
### Dependency injection container for re-action framework
####Usage
```php
//Creation
$container = new \Reaction\DI\Container([
'definitions' => [
'componentId' => [
'class' => 'Component\Class\Path',
'property_1' => 1,
'property_2' => InstanceOf('Component\Class\Path2'),
],
],
'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
```

0 comments on commit 2e1b46e

Please sign in to comment.