Documentation

DiContainer
in package

A wrapper around the DI\Container functionality that will allow static usage of container methods.

Table of Contents

Properties

$container  : ResettableContainer|ResettableCompiledContainer
$instance  : DiContainer

Methods

get()  : mixed
Retrieve the managed instance of $className, or construct a new instance with all dependencies.
getContainer()  : ResettableContainer|ResettableCompiledContainer
Return the raw dependency injection Container instance for more robust container management operations.
initialize()  : void
Create a new DI\Container instance.
initialized()  : bool
Check if a managed instance of $className has been created.
make()  : mixed
Construct a fresh instance of $className. Dependencies will be retrieved from the container if they are already managed, and created themselves if they are not.
__construct()  : mixed
buildContainer()  : ResettableContainer|ResettableCompiledContainer
getDefinitions()  : array<string, mixed>

Properties

Methods

get()

Retrieve the managed instance of $className, or construct a new instance with all dependencies.

public static get(string $className) : mixed
Parameters
$className : string

The name of the class to retrieve from the container.

Tags
throws
DependencyException
throws
NotFoundException

initialize()

Create a new DI\Container instance.

public static initialize(bool $enableCompilation) : void

This needs to be done once during a bootstrapping script, like bootstrap.php

Parameters
$enableCompilation : bool

initialized()

Check if a managed instance of $className has been created.

public static initialized(string $className) : bool

If the container itself has not been initialized yet, will always return false.

Parameters
$className : string
Return values
bool

make()

Construct a fresh instance of $className. Dependencies will be retrieved from the container if they are already managed, and created themselves if they are not.

public static make(string $className) : mixed
Parameters
$className : string

The name of the class to construct.

Tags
throws
DependencyException
throws
NotFoundException

__construct()

private __construct(bool $enableCompilation) : mixed
Parameters
$enableCompilation : bool

getDefinitions()

private getDefinitions() : array<string, mixed>
Return values
array<string, mixed>

        
On this page

Search results