class ContainerLoader

DI container loader.

Methods

__construct(string $tempDirectory, bool $autoRebuild = false)

No description

string
load(callable $generator, mixed $key = null)

Loads the container class, generating it if not already cached. Returns the class name.

string
getClassName(mixed $key)

Returns the container class name derived from the given key.

array
generate(string $class, callable $generator)

No description

Details

at line 19
__construct(string $tempDirectory, bool $autoRebuild = false)

No description

Parameters

string $tempDirectory
bool $autoRebuild

at line 38
string load(callable $generator, mixed $key = null)

Loads the container class, generating it if not already cached. Returns the class name.

In auto-rebuild mode, when the cached container file has been regenerated since the loaded class was first defined (e.g. user edited a config in a long-running process), a uniquely-named copy of the regenerated class is eval'd into memory and its name is returned instead. This bypasses PHP's inability to redeclare a loaded class and lets long-running processes (workers, dev servers, MCP inspector) pick up config edits live.

Parameters

callable $generator
mixed $key

Return Value

string

at line 48
string getClassName(mixed $key)

Returns the container class name derived from the given key.

Parameters

mixed $key

Return Value

string

at line 178
protected array generate(string $class, callable $generator)

No description

Parameters

string $class
callable $generator

Return Value

array