Skip to content

AutowireContainer

github-actions[bot] edited this page Oct 16, 2026 · 4 revisions

Resolves services through an optional delegate and native constructor autowiring.

Explicit delegate entries take precedence over autowiring. Without a delegate, an empty aggregate is created to resolve concrete dependency graphs directly.


Methods

__construct

Constructs the AutowireContainer.

public __construct(\Psr\Container\ContainerInterface|null $delegateContainer = null): mixed

Omission or null creates an empty AggregateContainer. An existing aggregate is reused; other PSR-11 containers are wrapped. Autowiring is appended last so delegate entries take precedence, including for nested dependencies.

Parameters:

Parameter Type Description
$delegateContainer \Psr\Container\ContainerInterface|null the optional delegate to wrap and extend

get

Retrieves an entry from the container by its identifier.

public get(string $id): mixed

Parameters:

Parameter Type Description
$id string identifier of the entry to retrieve

Return Value:

the resolved entry

Throws:

if the identifier is not found


has

Checks whether the composed container knows the entry without calling get().

public has(string $id): bool

Parameters:

Parameter Type Description
$id string the entry identifier

Return Value:

whether an entry or instantiable class is known

Throws:

if delegated lookup or class loading fails


Clone this wiki locally