This library adds Brotli support to PHP. Batteries included.
function brotli_compress(string $data, int $quality = 11): string
function brotli_uncompress(string $data): string
It is a fork of vdechenaux/brotli-php. Main differences:
- avoid usage of
ob_start
in\Symfony\Component\Process\Process
so you can use it inside anob_start
callback. - comes with prebuilt binaries from https://github.com/nlemoine/local-bin-brotli and automatic system guessing
composer require n5s/brotli
Prebuilt binaries included for the following systems:
- Linux (x86_64/i386)
- Mac OS
- Windows
If brotli
is available on your server, you set its path using:
\n5s\Brotli\Brotli::setBinaryPath('brotli');
or
\n5s\Brotli\Brotli::setBinaryPath('/some/dir/brotli');
composer test