An open API service indexing awesome lists of open source software.

https://github.com/rwillians/simple-di

Simple PHP7 DI alternative to Pimple
https://github.com/rwillians/simple-di

Last synced: 3 months ago
JSON representation

Simple PHP7 DI alternative to Pimple

Awesome Lists containing this project

README

        

# SimpleDI

Simple PHP7 DI container.

## Usage

```php
use Rwillians\SimpleDI\Container;
use Rwillians\SimpleDI\Contracts\ServiceLocatorInterface;

$container = new Container([
'foo' => 'bar',
'bar' => 'baz',
'baz' => 10,
]);

$container->set('awsome.number', function (ServiceLocatorInterface $serviceLocator) {
return $serviceLocator->get('baz') + 5;
});

echo $container->resolve('awsome.number'); // Outputs 15 (10 + 5)
```