Helper for referencing a container entry in a definition.
function entry(string $id): Entry
-
string
$idRequired. Container entry identifier to reference.
Nothing is thrown.
-
A reference to the container entry.
Helper for defining a container entry using a factory function/callable.
function factory(callable $callable, array $parameters = [], bool $register = true): Definition
-
callable
$callableRequired. A callable that returns the desired value.
-
array
$parametersOptional. Defaults to
[]
. A list of parameters to pass to the given callable. -
bool
$registerOptional. Defaults to
true
. Whether the entry returned should be registered by the container.
Nothing is thrown.
-
A container definition.
Helper for defining an object container entry.
function object(string $className, array $parameters = [], bool $register = true): Definition
-
string
$classNameRequired. The class name of the object to define. Use of the
::class
constant is recommended. -
array
$parametersOptional. Defaults to
[]
. A list of parameters to pass to the given class's constructor. -
bool
$registerOptional. Defaults to
true
. Whether the entry returned should be registered by the container.
Nothing is thrown.
-
A container definition.
Helper for defining a generic value container entry.
function value($value, bool $register = true): Definition
-
mixed
$valueRequired. The value the container should return.
-
bool
$registerOptional. Defaults to
true
. Whether the value returned should be registered by the container.
Nothing is thrown.
-
A container definition.