lessname / locator
This package is abandoned and no longer maintained.
No replacement package was suggested.
Service locator
3.1.0
2020-03-28 09:01 UTC
Requires
- php: ^7.4.0
Requires (Dev)
- lessname/lint: ^2.0.0
- lessname/test: ^2.0.0
README
Locate your services
License
Mozilla Public License 2.0
Examples
<?php
use LessLocator\Builder\ResolverLocatorBuilder;
use LessLocator\Config\ArrayConfig;
$config = new ArrayConfig(
[
'services' => [
'initiators' => [
// value is called with new
stdClass::class => stdClass::class,
],
'factories' => [
// A factory is used to create the instance
],
'aliases' => [
// the value is an other name to use
],
'map' => [
// value is returned directly
],
],
]
);
$locator = ResolverLocatorBuilder::fromConfig($config);
$locator->getService(stdClass::class); // stdClass instance