A middlewares/minifier fork, but using HTTP Message Strategies PSR (pre-Draft)
HTTP Message Strategies to minify the Html
, CSS
and Javascript
content using mrclay/minify. This package is splited into the following components:
$streamFactory = new StreamFactory(); // A PSR-17 StreamFactory
foreach ([
new CssMinifier($streamFactory),
new JsMinifier($streamFactory),
new HtmlMinifier($streamFactory),
] as $minifier) {
$response = $minifier($response);
}
Minifies the code of html responses. Make sure the response contains the header Content-Type: text/html
(you can use middlewares/negotiation).
Set false
to do not minify inline css. (true
by default)
Set false
to do not minify inline js. (true
by default)
Minifies the code of css responses. Make sure the response contains the header Content-Type: text/css
.
Minifies the code of javascript responses. Make sure the response contains the header Content-Type: text/javascript
.
The MIT License (MIT). Please see LICENSE for more information.