mini\Mini::addService() public

Documentation

Register a service with the container

Can only be called in Bootstrap phase (before mini\bootstrap()). The container is locked once request handling begins.

Signature

public function addService(string $id, mini\Lifetime $lifetime, Closure $factory, ?int $maxInstances = NULL, float $timeout = 30.0): void

Parameters

NameTypeDefault
$id string required
$lifetime mini\Lifetime required
$factory Closure required
$maxInstances ?int NULL
$timeout float 30.0

Returns

void

Source

src/Mini.php:373-399