DIContainer Class
Definition
Namespace: DafCore
Phar: DafCore.phar
Implements: IDIContainer
a software library that provides DI functionality and allows automating many of the tasks involved in Object Composition, Interception, and Lifetime Management. ability to automatically compose an object graph from maps between Abstractions and concrete types.
Methods
function AddSingleton(string $key, Closure $callback): void
Register service the current DI Container.
callback return value will be used as the service. create only one instance.
function AddScop(string $key, Closure $callback): void
Register service the current DI Container.
callback return value will be used as the service.
function BindInterface(string $interface, string $concrete): void
Bind interface to same concrete service that Register in DI Container.
function Exists(string $key): bool
Return true if service is in the DI Container by key.
function GetOne(string $key): mixed
Get service by key in the DI Container.
function GetAll(array $keys): array
Get All service by keys in the DI Container.