Reference implementations of Ioc-Interop.

Installs: 0

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/ioc-interop/impl

1.x-dev 2026-01-31 15:07 UTC

This package is auto-updated.

Last update: 2026-01-31 15:07:23 UTC


README

PDS Skeleton PDS Composer Script Names

This package offers a reference implementation all the Ioc-Interop interface to present a typical "open" autowired container.

Installation

$ composer require ioc-interop/impl

Getting Started

use IocInterop\Impl\Container;
use IocInterop\Interface\IocContainer;

$ioc = new Container();

Getting Services

$foo = $ioc->getService(Foo::class);

Setting Service Instances

$ioc->setService(Foo::class, new Foo());

Setting Service Aliases

$ioc->setAlias('foo.foo', Foo::class);
$foo = $ioc->getService('foo.foo');

Defining Services

Service Factory

$ioc->getDefinition(Foo::class)
    ->setFactory(fn (IocContainer $ioc) : Foo => return new Foo());

Service Extenders

$ioc->getDefinition(Foo::class)
    ->addExtender(function (IocContainer $ioc, Foo $foo) : Foo {
        $foo->bar = 'baz';
        return $foo;
    });