Container
in package
Class Container is a simple dependency injection container.
Table of Contents
- $instances : array<string|int, mixed>
- A list of created instances
- $services : array<string|int, mixed>
- A list of registered services
- get() : object
- Method for getting a registered service.
- set() : void
- The method for registering a new service.
Properties
$instances
A list of created instances
protected
array<string|int, mixed>
$instances
= array()
$services
A list of registered services
protected
array<string|int, mixed>
$services
= array()
Methods
get()
Method for getting a registered service.
public
get(string $name) : object
Parameters
- $name : string
-
The name of the service.
Tags
Return values
object — The service instance.set()
The method for registering a new service.
public
set(string $name, callable $callback) : void
Parameters
- $name : string
-
The name of the service.
- $callback : callable
-
The callable that will be used to create the service.