rwillians / simple-di
Simple - a simple PHP7 DI alternative to Pimple
v0.1.0-alpha
2016-09-05 02:41 UTC
Requires
- php: ^7.0
Requires (Dev)
- mockery/mockery: ^0.9.5
- phpunit/phpunit: ^5.5
This package is not auto-updated.
Last update: 2025-01-18 21:36:10 UTC
README
Simple PHP7 DI container.
Usage
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)