lessname / locator
Installs: 9 222
Dependents: 4
Suggesters: 1
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: ^8.4.0
- psr/container: ^2.0.0
Requires (Dev)
- phpstan/phpstan: ^2.0.0
- phpunit/phpunit: ^11.0.0
- squizlabs/php_codesniffer: ^3.6.0
This package is auto-updated.
Last update: 2024-12-29 20:21:04 UTC
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