Download the PHP package middlewares/minifier without Composer
On this page you can find all versions of the php package middlewares/minifier. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download middlewares/minifier
More information about middlewares/minifier
Files in middlewares/minifier
Package minifier
Short Description Middleware to minify Html, CSS and Javascript responses
License MIT
Homepage https://github.com/middlewares/minifier
Informations about the package minifier
middlewares/minifier
Middleware to minify the Html
, CSS
and Javascript
content using wyrihaximus/compress and the following compressors by default:
Requirements
- PHP >= 7.2
- A PSR-7 http library
- A PSR-15 middleware dispatcher
Installation
This package is installable and autoloadable via Composer as middlewares/minifier.
Example
Usage
This middleware minify the code of http responses using any compressor implementing the WyriHaximus\Compress\CompressorInterface
. The code format is detected from the Content-Type
header, so make sure your responses contains this header (you may want to use middlewares/negotiation for that).
Optionally, you can provide a Psr\Http\Message\StreamFactoryInterface
as third argument to create the response body. If it's not defined, Middleware\Utils\Factory will be used to detect it automatically.
Helpers
Three static functions are provided to create instances of this middleware with common configuration for html, css and js responses:
Please see CONTRIBUTING for contributing details.
The MIT License (MIT). Please see LICENSE for more information.
All versions of minifier with dependencies
middlewares/utils Version ^3.0 || ^4.0
psr/http-server-middleware Version ^1.0
wyrihaximus/html-compress Version ^3.0 || ^4.0