class StackedKernelPass implements CompilerPassInterface (View source)

Provides a compiler pass for stacked HTTP kernels.

Builds the HTTP kernel by collecting all services tagged 'http_middleware' and assembling them into a StackedKernel. The middleware with the highest priority ends up as the outermost while the lowest priority middleware wraps the actual HTTP kernel defined by the http_kernel.basic service.

The 'http_middleware' service tag additionally accepts a 'responder' parameter. It should be set to TRUE if many or most requests will be handled directly by the middleware. Any underlying middleware and the HTTP kernel are then flagged as 'lazy'. As a result those low priority services and their dependencies are only initialized if the 'responder' middleware fails to generate a response and the request is delegated to the underlying kernel.

In general middlewares should not have heavy dependencies. This is especially important for high-priority services which need to run before the internal page cache.

An example of a high priority middleware.

Methods

process(ContainerBuilder $container)

{@inheritdoc}

Details

process(ContainerBuilder $container)

{@inheritdoc}

Parameters

ContainerBuilder $container