Swoole\Http\Response->gzip

Declaration

<?php
Swoole\Http\Response->gzip(int $gziplevel = 1)

Parameters

gziplevel

HTTP gzip level

Return

Response

Description

Enable the gzip of response content. The header about Content-Encoding will be added automatically.

Set the HTTP gzip level.

This method must be called before the $response->end method.

This method needs zlib. Install zlib by sudo apt-get install libz-dev

Example