kiwi-suite/servicemanager

IXOCREATE Servicemanager Library

1.0.0 2021-02-01 14:40 UTC

This package is not auto-updated.

Last update: 2024-11-10 02:00:07 UTC


README

Build Status Coverage Status Packagist PHP Version License

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.