Fast Forward Container API

functions.php

This file is part of php-fast-forward/container.

This source file is subject to the license bundled with this source code in the file LICENSE.

Tags
link
https://github.com/php-fast-forward/container
copyright

Copyright (c) 2025 Felipe Sayão Lobato Abreu github@mentordosnerds.com

license

https://opensource.org/licenses/MIT MIT License

see
https://datatracker.ietf.org/doc/html/rfc2119

Table of Contents

Functions

container()  : ContainerInterface
Creates and assembles a fully composed container instance.

Functions

container()

Creates and assembles a fully composed container instance.

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

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

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

Tags
throws
InvalidArgumentException

if an unsupported initializer type is encountered

Return values
ContainerInterface

the composed and autowire-enabled container


        
On this page

Search results