ixocreate / servicemanager
IXOCREATE Servicemanager Library
Installs: 9 252
Dependents: 2
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 1
Open Issues: 1
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 auto-updated.
Last update: 2024-11-05 18:29:35 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.