PHPackages                             mackjoner/php-ext-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. [Utility &amp; Helpers](/categories/utility)
4. /
5. mackjoner/php-ext-brotli

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

mackjoner/php-ext-brotli
========================

Brotli Extension for PHP, Documentation for Brotli can be found at https://github.com/google/brotli/.

039PHP

Since Feb 6Pushed 8y agoCompare

[ Source](https://github.com/mackjoner/php-ext-brotli)[ Packagist](https://packagist.org/packages/mackjoner/php-ext-brotli)[ RSS](/packages/mackjoner-php-ext-brotli/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Brotli Extension for PHP
========================

[](#brotli-extension-for-php)

[![Build Status](https://camo.githubusercontent.com/3ca6990ed5c38e5fceccc6122dc327faf7b74f030651ce296eb06299ebf84746/68747470733a2f2f7472617669732d63692e6f72672f6b6a6465762f7068702d6578742d62726f746c692e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/kjdev/php-ext-brotli)

This extension allows Brotli compression.

Documentation for Brotli can be found at [» https://github.com/google/brotli/](https://github.com/google/brotli/).

Build
-----

[](#build)

```
% git clone --recursive --depth=1 https://github.com/kjdev/php-ext-brotli.git
% cd php-ext-brotli
% phpize
% ./configure
% make
$ make install

```

To use the system library (using pkg-config)

```
% ./configure --with-libbrotli
```

Distribution binary packages
----------------------------

[](#distribution-binary-packages)

### Fedora / CentOS / RHEL

[](#fedora--centos--rhel)

RPM packages of this extension are available in [» Remi's RPM repository](https://rpms.remirepo.net/) and are named **php-brotli**.

Configuration
-------------

[](#configuration)

brotli.ini:

```
extension=brotli.so

```

Function
--------

[](#function)

- brotli\_compress — Compress a string
- brotli\_uncompress — Uncompress a compressed string

brotli\_compress — Compress a string
------------------------------------

[](#brotli_compress--compress-a-string)

### Description

[](#description)

string **brotli\_compress** ( string *$data* \[, int *$quality* = 11, int *$mode* = -1 \] )

This function compress the given string using the ZLIB data format.

### Parameters

[](#parameters)

- *data*

    The data to compress.
- *quality*

    The higher the quality, the slower the compression. (Defaults to 11)
- *mode*

    The compression mode can be `BROTLI_GENERIC` (default), `BROTLI_TEXT` (for UTF-8 format text input) or `BROTLI_FONT` (for WOFF 2.0).

### Return Values

[](#return-values)

The compressed string or FALSE if an error occurred.

### brotli\_uncompress — Uncompress a compressed string

[](#brotli_uncompress--uncompress-a-compressed-string)

### Description

[](#description-1)

string **brotli\_uncompress** ( string *$data* \[, int *$length* = 0 \] )

This function uncompress a compressed string.

### Parameters

[](#parameters-1)

- *data*

    The data compressed by brotli\_compress().
- *length*

    The maximum length of data to decode.

### Return Values

[](#return-values-1)

The original uncompressed data or FALSE on error.

Examples
--------

[](#examples)

```
$compressed = brotli_compress('Compresstest');

$uncompressed = brotli_uncompress($compressed);

echo $uncompressed;

```

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 68.4% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/897edf23739ad1cd307f2309c697ad1f2713518223eb14d313ce5b252dcdcdec?d=identicon)[mackjoner](/maintainers/mackjoner)

---

Top Contributors

[![kjdev](https://avatars.githubusercontent.com/u/465132?v=4)](https://github.com/kjdev "kjdev (13 commits)")[![remicollet](https://avatars.githubusercontent.com/u/270445?v=4)](https://github.com/remicollet "remicollet (3 commits)")[![jbanety](https://avatars.githubusercontent.com/u/1055330?v=4)](https://github.com/jbanety "jbanety (1 commits)")[![mackjoner](https://avatars.githubusercontent.com/u/1662122?v=4)](https://github.com/mackjoner "mackjoner (1 commits)")[![mjanda](https://avatars.githubusercontent.com/u/652954?v=4)](https://github.com/mjanda "mjanda (1 commits)")

### Embed Badge

![Health badge](/badges/mackjoner-php-ext-brotli/health.svg)

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

###  Alternatives

[nativephp/electron

Electron wrapper for the NativePHP framework.

519114.4k8](/packages/nativephp-electron)[kadet/keylighter

Yet another syntax highlighter for PHP

333.2k1](/packages/kadet-keylighter)[code16/formoj

Customizable form renderer

332.6k](/packages/code16-formoj)[nullthoughts/laravel-data-sync

Laravel utility to keep records synced between environments through source control

331.4k](/packages/nullthoughts-laravel-data-sync)

PHPackages © 2026

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