Name: encoder
Owner: Middlewares
Description: PSR-15 middleware to encode the response body to gzip or deflate
Created: 2016-10-11 10:01:38.0
Updated: 2017-03-30 17:41:36.0
Pushed: 2018-01-27 14:27:54.0
Homepage: null
Size: 26
Language: PHP
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Middleware to encode the response body to gzip
or deflate
if the Accept-Encoding
header is present and adds the Content-Encoding
header. This package is splitted into the following components:
You can use the component ContentEncoding
in the middlewares/negotiation to negotiate the encoding to use.
This package is installable and autoloadable via Composer as middlewares/encoder.
oser require middlewares/encoder
patcher = new Dispatcher([
new Middlewares\GzipEncoder(),
ponse = $dispatcher->dispatch(new ServerRequest());
Compress the response body to GZIP format using gzencode and add the header Content-Encoding: gzip
.
Note: The response body is encoded only if the header contains the value gzip
in the header Accept-Encoding
.
Compress the response body to Deflate format using gzdeflate and add the header Content-Encoding: deflate
.
Note: The response body is encoded only if the header contains the value deflate
in the header Accept-Encoding
.
Please see CHANGELOG for more information about recent changes and CONTRIBUTING for contributing details.
The MIT License (MIT). Please see LICENSE for more information.