Container

Namespace

Table of Contents

Namespaces

Interfaces

ContainerInterface

Extends the PSR-11 ContainerInterface to provide a consistent, domain-specific container interface for the FastForward ecosystem.

Classes

AggregateContainer

Aggregates multiple PSR-11 containers and delegates resolution requests among them.

AutowireContainer

A composite container implementation that wraps another PSR-11 container and appends an internal PHP-DI autowiring container.

ServiceProviderContainer

Implements a PSR-11 compliant dependency injection container using a container-interop/service-provider.

Functions

container()

Creates and assembles a fully composed container instance.

 : ContainerInterface
Functions

Functions

container()

Creates and assembles a fully composed container instance.

container(ConfigInterface|ContainerInterface|ServiceProviderInterface|string  ...$initializers) : ContainerInterface

Description

This factory function is responsible for composing a container from a list of initializers, which MAY include:

  • PSR-11 container instances
  • Service providers implementing ServiceProviderInterface
  • Configuration instances implementing ConfigInterface
  • Class names as strings (which MUST be instantiable)

If a ConfigContainer is included, it SHALL attempt to resolve additional nested container definitions from its configuration using the key ${alias}.${ContainerInterface::class}. Any invalid initializers MUST result in an InvalidArgumentException being thrown.

The final container returned is an AutowireContainer that wraps an AggregateContainer composed of all resolved sources.

Parameters
$initializers : ConfigInterface|ContainerInterface|ServiceProviderInterface|string

Description

A variadic list of container initializers, optionally including config or provider classes.

Tags
throws

Description

if an unsupported initializer type is encountered

Return values

Description

the composed and autowire-enabled container