Skip to content

FactoryInterface

github-actions edited this page Mar 27, 2026 · 2 revisions

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

Implementing classes MUST implement the __invoke method which SHALL be responsible for returning the fully constructed service instance.

This interface is commonly used in container-based systems to register factories dynamically.


  • Full name: \FastForward\Container\Factory\FactoryInterface

Methods

__invoke

Creates a service instance using the provided container.

public __invoke(\Psr\Container\ContainerInterface $container): mixed

Implementations MUST resolve all necessary dependencies from the container and return a fully constructed instance.

Parameters:

Parameter Type Description
$container \Psr\Container\ContainerInterface the PSR-11 compliant container providing dependencies

Return Value:

the created service instance


Clone this wiki locally