Skip to documentation

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

Resolves services through an optional delegate and native constructor autowiring.

ContainerBuilder

Registers ordered initializers and builds independent container compositions.

ContainerFactory

Composes a fresh container through the incremental ContainerBuilder API.

AutowiringException

Signals a constructor dependency graph that cannot be inferred.

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 public method on a class or a container-provided object.

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 convenience function delegates composition to ContainerFactory::create(). Accepted initializers 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}. Unknown initializer classes and unsupported constructed objects 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 initializer class cannot be found or adapted

Return values

Description

the composed and autowire-enabled container

Search results