Container

Namespace

Table of Contents

Interfaces

ContainerInterface

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

FactoryInterface

Defines a contract for service factories that rely on a PSR-11 container for instantiation.

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.

ContainerException

Exception type for container-related errors while resolving services.

InvalidArgumentException

Exception thrown when an invalid or unsupported argument is passed to a function or method within the container.

NotFoundException

Exception thrown when a requested service identifier is not found in the container.

RuntimeException

Exception type used to represent runtime errors specific to the container context.

AliasFactory

A factory that resolves an alias to another service within a PSR-11 container.

CallableFactory

A factory that wraps a user-provided callable and executes it when invoked.

InvokableFactory

Factory responsible for instantiating a class with constructor arguments.

MethodFactory

A factory that invokes a specified method on a class using reflection and the PSR-11 container.

ServiceFactory

This factory wraps a predefined service instance and returns it directly upon invocation.

AggregateServiceProvider

Aggregates multiple service providers into a single provider.

ArrayServiceProvider

Class ArrayServiceProvider.

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