FactoryInterface
in
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.
Table of Contents
Methods
- __invoke() : mixed
- Creates a service instance using the provided container.
Methods
__invoke()
Creates a service instance using the provided container.
public
__invoke(ContainerInterface $container) : mixed
Implementations MUST resolve all necessary dependencies from the container and return a fully constructed instance.
Parameters
- $container : ContainerInterface
-
the PSR-11 compliant container providing dependencies
Return values
mixed —the created service instance