yep / container
Container for PHP
dev-master
2018-01-07 03:03 UTC
Requires
- php: >=5.6
Requires (Dev)
- phpunit/phpunit: ^5.7
This package is auto-updated.
Last update: 2024-12-11 19:30:48 UTC
README
Dsn
Packagist
Dsn is available on Packagist.org, just add the dependency to your composer.json.
{ "require" : { "yep/container": "dev-master" } }
Usage
<?php use Yep\Container\ContainerInterface; use Yep\Container\ContainerTrait; class Container implements ContainerInterface { use ContainerTrait; public function someServiceFactory() { return new SomeService($this->getParameter('someParameter')); } } $container = new Container(['someParameter' => 'foo']); $someService = $container->getService('someService');
or
<?php class Container extends Yep\Container\Container { public function someServiceFactory() { return new SomeService($this->getParameter('someParameter')); } } $container = new Container(['someParameter' => 'foo']); $someService = $container->getService('someService');