FactoryInterface

Interface

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

Description

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.

Table of Contents

Methods

__invoke()

Creates a service instance using the provided container.

 : mixed
Methods

__invoke()

Public

Creates a service instance using the provided container.

public __invoke(ContainerInterface  $container) : mixed

Description

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

Parameters
$container : ContainerInterface

Description

the PSR-11 compliant container providing dependencies

Return values

Description

the created service instance