n5s/brotli

Add brotli compress/uncompress functions to PHP. Batteries included.

2.0.0 2024-07-05 13:56 UTC

This package is auto-updated.

Last update: 2024-12-05 14:49:24 UTC


README

PHP unit tests Packagist Downloads

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:

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