n5s / brotli
Add brotli compress/uncompress functions to PHP. Batteries included.
2.0.0
2024-07-05 13:56 UTC
Requires
- php: ^8.1
- n5s/local-bin-brotli: ^1.1.2
- symfony/process: ^6.0 || ^7.0
Requires (Dev)
- ergebnis/composer-normalize: ^2.43
- phpunit/phpunit: ^9.0
README
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
Installation
composer require n5s/brotli
Binaries
brotli
is not available on your system/server
Prebuilt binaries included for the following systems:
- Linux (x86_64/i386)
- Mac OS
- Windows
brotli
is available on your system/server
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');
Tests
composer test