Skip to content

ContainerBuilder

github-actions[bot] edited this page Oct 13, 2026 · 1 revision

Registers ordered initializers and builds independent container compositions.

Registration SHALL retain source objects and class names without resolving services. Each build() MUST create a fresh aggregate, provider/config adapters, and autowiring container. Supplied PSR-11 containers SHALL be reused without cloning their state.

Later registrations SHALL affect subsequent builds only. Provider adapters SHALL receive their build's aggregate so dependencies can resolve across all sources.


  • Full name: \FastForward\Container\ContainerBuilder
  • This class is marked as final and can't be subclassed
  • This class is a Final class

Methods

add

Registers one or more initializers for subsequent builds.

public add(\FastForward\Config\ConfigInterface|\Psr\Container\ContainerInterface|\Interop\Container\ServiceProviderInterface|string $initializers): self

This method SHALL append sources in their supplied order and return this builder. Class names SHALL be instantiated and adapted when build() is called. Previously built containers MUST NOT be changed by later registrations.

Parameters:

Parameter Type Description
$initializers \FastForward\Config\ConfigInterface|\Psr\Container\ContainerInterface|\Interop\Container\ServiceProviderInterface|string the configuration objects, containers, providers, or initializer class names

Return Value:

this builder for incremental, fluent registration


build

Creates a fresh container stack from the registered initializers.

public build(): \FastForward\Container\ContainerInterface

This method SHALL adapt sources in registration order, append optional configured sources, and return an AutowireContainer wrapping the completed aggregate. Class names MUST be instantiable without required constructor arguments. The builder SHALL retain registrations without retaining assembled container state.

Return Value:

the composed and autowire-enabled container

Throws:

if an initializer class cannot be found or adapted


Clone this wiki locally