ioc-interop / impl
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
Requires
- php: ^8.4
- env-interop/interface: 1.x@dev
- ioc-interop/interface: 1.x@dev
Requires (Dev)
- pds/composer-script-names: ^1.0
- pds/skeleton: ^1.0
- phpstan/phpstan: ^2.0
- phpunit/phpunit: ^11.0
This package is auto-updated.
Last update: 2026-01-31 15:07:23 UTC
README
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; });