PHPackages                             hostbybelle/compressionbuffer - 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. hostbybelle/compressionbuffer

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

hostbybelle/compressionbuffer
=============================

CompressionBuffer provides easy access to zstd, brotli, and gzip output buffering with PHP on any webserver.

1.1.1(5mo ago)44.2k↓50%Apache-2.0PHPPHP &gt;=8.0CI passing

Since Apr 8Pushed 4mo ago1 watchersCompare

[ Source](https://github.com/HostByBelle/CompressionBuffer)[ Packagist](https://packagist.org/packages/hostbybelle/compressionbuffer)[ RSS](/packages/hostbybelle-compressionbuffer/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (3)Versions (5)Used By (0)

[![PHPStan Level](https://camo.githubusercontent.com/b72adb1f27170ecf486459c4b07e920bb3db2b464444bce8277e018270665646/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d6c6576656c253230392d627269676874677265656e)](https://camo.githubusercontent.com/b72adb1f27170ecf486459c4b07e920bb3db2b464444bce8277e018270665646/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d6c6576656c253230392d627269676874677265656e)[![Unit Tests](https://github.com/HostByBelle/CompressionBuffer/actions/workflows/unittest.yml/badge.svg)](https://github.com/HostByBelle/CompressionBuffer/actions/workflows/unittest.yml)[![Packagist Downloads](https://camo.githubusercontent.com/cd75fc6e1d3a1aefe0319f9007e7d0d095fe8b9f1959f2966f5fe28fa660b4dd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f486f7374427942656c6c652f436f6d7072657373696f6e427566666572)](https://camo.githubusercontent.com/cd75fc6e1d3a1aefe0319f9007e7d0d095fe8b9f1959f2966f5fe28fa660b4dd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f486f7374427942656c6c652f436f6d7072657373696f6e427566666572)[![Packagist Version](https://camo.githubusercontent.com/be10dcf4d93e2c99a630730bfcaa2653b921d0d47244f75320db29800f91f24c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f486f7374427942656c6c652f436f6d7072657373696f6e427566666572)](https://camo.githubusercontent.com/be10dcf4d93e2c99a630730bfcaa2653b921d0d47244f75320db29800f91f24c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f486f7374427942656c6c652f436f6d7072657373696f6e427566666572)

CompressionBuffer
=================

[](#compressionbuffer)

CompressionBuffer provides easy access to `zstd`, `brotli`, and `gzip` output buffering with PHP on **any** web server. You can even get zstd [output compression with the PHP development server](https://github.com/HostByBelle/CompressionBuffer/blob/main/misc/zstd-php-dev-server.png).

Features
--------

[](#features)

- Respects the `Accept-Encoding` header sent by the client, including the specified priority for each compression method.
- Allows `zstd`, `brotli`, `gzip` and `deflate` compression methods to be used on any web server.
- All included compression methods have been benchmarked with compression levels carefully selected for the ideal balance between speed and size reduction.
- Auto-selects the compression method based on client headers and available PHP extensions.
- Automatically sends the appropriate headers.

Requirements
------------

[](#requirements)

- A PHP application using output buffering.
- `PHP 8.0` or greater.
- `ext-brotli` if you want brotli compression.
- `ext-zstd`if you want zstd compression.
- `ext-zlib` if you want gzip / deflate compression.

Installation &amp; Usage
------------------------

[](#installation--usage)

Install via composer:

```
composer require hostbybelle/compressionbuffer
```

Enabling in your application:

```
