kiwi-suite / servicemanager
IXOCREATE Servicemanager Library
1.0.0
2021-02-01 14:40 UTC
Requires
- php: ^7.2 || ^8.0
- laminas/laminas-di: ^3.1
- laminas/laminas-servicemanager: ^3.5
- ocramius/proxy-manager: ^2.1.1
Requires (Dev)
- ixocreate/coding-standard: ^2.0
- ixocreate/test: 0.1.1
- vimeo/psalm: ^3.6
This package is not auto-updated.
Last update: 2024-11-10 02:00:07 UTC
README
IXOCREATE Servicemanager is a PSR 11 container library utilizing laminas/laminas-servicemanager.
Installation
Install the package via composer:
composer require ixocreate/servicemanager
Testing
composer install --dev phpunit
Usage
$configurator = new ServiceManagerConfigurator(); $configurator->addFactory(SomeObject::class); $configurator->addFactory(AnotherObject::class, AnotherObjectFactory::class); $configurator->addLazyService(SomeObject::class); $serviceManager = new ServiceManager($configurator->serviceManagerConfig(), new ServiceManagerSetup()); $serviceManager->get(SomeObject::class); $serviceManager->build(AnotherObject::class);
Factories
A factory is any class that implements the interface Ixocreate\ServiceManager\FactoryInterface
.
class SomeObjectFactory implements FactoryInterface { public function __invoke(ServiceManagerInterface $container, $requestedName, array $options = null) { return new SomeObject(); } } $configurator = new ServiceManagerConfigurator(); $configurator->addFactory(SomeObject::class, SomeObjectFactory::class); $serviceManager = new ServiceManager($configurator->serviceManagerConfig(), new ServiceManagerSetup()); $serviceManager->get(SomeObject::class);
Documentation
Learn more about IXOCREATE by reading its Documentation.
Changelog
Please see CHANGELOG for more information on what has changed recently.
Security Vulnerabilities
If you discover security vulnerabilities, please address issues directly to opensource@ixocreate.com via e-mail.
License
The MIT License (MIT). Please see LICENSE for more information.