PHPackages                             n5s/brotli - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. n5s/brotli

ActiveLibrary

n5s/brotli
==========

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

3.0.0(4mo ago)48.3k↑15.2%1MITPHPPHP ^8.2CI passing

Since Apr 23Pushed 4mo agoCompare

[ Source](https://github.com/nlemoine/brotli-php)[ Packagist](https://packagist.org/packages/n5s/brotli)[ RSS](/packages/n5s-brotli/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (6)Versions (8)Used By (0)

[![Tests](https://camo.githubusercontent.com/ef6fe93a7e4b17d023785fc46181c6badff23a72784942e94e0d106ffed3fa14/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6e6c656d6f696e652f62726f746c692d7068702f71612e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473)](https://github.com/nlemoine/brotli-php/actions/workflows/qa.yml)[![Packagist Downloads](https://camo.githubusercontent.com/af0512848bfc5eae7dbb2d591efedcce894f4e77e9e5480dd6696685e3746d56/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6e35732f62726f746c69)](https://camo.githubusercontent.com/af0512848bfc5eae7dbb2d591efedcce894f4e77e9e5480dd6696685e3746d56/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6e35732f62726f746c69)

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](https://github.com/vdechenaux/brotli-php). Main differences:

- avoid usage of `ob_start` in [`\Symfony\Component\Process\Process`](https://github.com/symfony/process/blob/b8d6eff26e48187fed15970799f4b605fa7242e4/Process.php#L1383-L1386) so you can use it inside an `ob_start` callback.
- comes with prebuilt binaries from  and automatic system guessing

Installation
------------

[](#installation)

```
composer require n5s/brotli
```

Binaries
--------

[](#binaries)

### `brotli` is not available on your system/server

[](#brotli-is-not-available-on-your-systemserver)

Prebuilt binaries included for the following systems:

- Linux (x86\_64/i386)
- Mac OS
- Windows

### `brotli` is available on your system/server

[](#brotli-is-available-on-your-systemserver)

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
-----

[](#tests)

```
composer test

```

###  Health Score

51

—

FairBetter than 96% of packages

Maintenance75

Regular maintenance activity

Popularity30

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity73

Established project with proven stability

 Bus Factor1

Top contributor holds 57.1% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~520 days

Total

5

Last Release

135d ago

Major Versions

1.2.0 → 2.0.02024-07-05

2.0.0 → 3.0.02026-01-03

PHP version history (4 changes)1.0.0PHP ^7.1

1.1.0PHP ^7.4 || ^8.0

2.0.0PHP ^8.1

3.0.0PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/62f16c9d375343e12eb02b2a3095dc9a02047287b5f12f75ef4c59929fcb2802?d=identicon)[n5s](/maintainers/n5s)

---

Top Contributors

[![nlemoine](https://avatars.githubusercontent.com/u/2526939?v=4)](https://github.com/nlemoine "nlemoine (12 commits)")[![vdechenaux](https://avatars.githubusercontent.com/u/1501825?v=4)](https://github.com/vdechenaux "vdechenaux (5 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (2 commits)")[![chapeupreto](https://avatars.githubusercontent.com/u/834048?v=4)](https://github.com/chapeupreto "chapeupreto (1 commits)")[![tfink](https://avatars.githubusercontent.com/u/3719286?v=4)](https://github.com/tfink "tfink (1 commits)")

---

Tags

brotli

###  Code Quality

TestsPHPUnit

Static AnalysisRector

Code StyleECS

### Embed Badge

![Health badge](/badges/n5s-brotli/health.svg)

```
[![Health](https://phpackages.com/badges/n5s-brotli/health.svg)](https://phpackages.com/packages/n5s-brotli)
```

###  Alternatives

[spatie/laravel-health

Monitor the health of a Laravel application

86910.0M83](/packages/spatie-laravel-health)[illuminate/console

The Illuminate Console package.

12944.1M5.1k](/packages/illuminate-console)[temporal/sdk

Temporal SDK

4002.2M18](/packages/temporal-sdk)[illuminate/process

The Illuminate Process package.

44699.5k65](/packages/illuminate-process)[statamic/cli

Statamic CLI Tool

7587.7k](/packages/statamic-cli)[vdechenaux/brotli

Add brotli compress/uncompress functions to PHP

2468.3k1](/packages/vdechenaux-brotli)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
