final class KernelFactory (View source)

Factory for assembling the HTTP application kernel.

The factory accepts an optional preconfigured dependency injection container and an optional response emitter. When they are not supplied, it creates a default container and response emitter, builds a framework runtime for the provided application context, and returns a fully wired kernel instance.

Methods

__construct(ContainerInterface|null $container = null, ResponseEmitter|null $emitter = null)

Configures optional runtime dependencies used when creating kernels.

Creates a new HTTP kernel for the provided application context.

Details

__construct

__construct(ContainerInterface|null $container = null, ResponseEmitter|null $emitter = null)

Configures optional runtime dependencies used when creating kernels.

The supplied container is reused by both the framework runtime and the resulting kernel. When no container is provided, a default container is created. The supplied emitter is used by {\Lemonade\Framework\Core\Kernel::handle()}, and a default response emitter is created when none is provided.

Parameters

ContainerInterface|null $container
ResponseEmitter|null $emitter

create

Creates a new HTTP kernel for the provided application context.

The method reuses or creates a dependency injection container, builds a framework runtime with the same container and context, and then creates a kernel with the same context, container, framework, and response emitter.

The created kernel is returned without bootstrapping or running a request.

Parameters

ApplicationContext $context

Return Value

Kernel