dev-master
9999999-dev https://github.com/YepFoundation/containerContainer for PHP
GPL-3.0 BSD-3-Clause GPL-2.0
The Requires
- php >=5.6
The Development Requires
container
Wallogit.com
2017 © Pedro Peláez
Container for PHP
Dsn is available on Packagist.org, just add the dependency to your composer.json., (*2)
{
"require" : {
"yep/container": "dev-master"
}
}
<?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, (*3)
<?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');
Container for PHP
GPL-3.0 BSD-3-Clause GPL-2.0
container