final class HtmlMinifyMiddleware implements MiddlewareInterface (View source)

Minifies non-empty HTML responses when enabled while preserving response immutability.

Methods

Connects the HTML transformer with its resolved runtime switch.

ResponseInterface
process(ServerRequestInterface $request, RequestHandlerInterface $handler)

Replaces eligible response bodies and recalculates their Content-Length header.

ResponseInterface

Details

__construct

__construct(HtmlMinifier $minifier, HtmlMinifyConfig $config)

Connects the HTML transformer with its resolved runtime switch.

Parameters

HtmlMinifier $minifier
HtmlMinifyConfig $config

process

ResponseInterface process(ServerRequestInterface $request, RequestHandlerInterface $handler)

Replaces eligible response bodies and recalculates their Content-Length header.

Parameters

ServerRequestInterface $request
RequestHandlerInterface $handler

Return Value

ResponseInterface