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
- Host: GitHub
- URL: https://github.com/rwillians/simple-di
- Owner: rwillians
- License: mit
- Created: 2016-06-05T18:32:33.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-04-13T04:58:52.000Z (about 8 years ago)
- Last Synced: 2025-01-10T15:24:42.890Z (4 months ago)
- Language: PHP
- Homepage:
- Size: 27.3 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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)
```