Download the PHP package xp-forge/compression without Composer
On this page you can find all versions of the php package xp-forge/compression. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download xp-forge/compression
More information about xp-forge/compression
Files in xp-forge/compression
Package compression
Short Description Compression I/O for the XP Framework
License BSD-3-Clause
Homepage http://xp-framework.net/
Informations about the package compression
Compression streams
Compressing output and decompressing input streams including GZip, BZip2, Brotli, Snappy and ZStandard.
Examples
Reading a GZIP-compressed file:
Writing a file, compressing the data on-the-fly with BZIP2:
Dependencies
Compression algorithms might require a specific PHP extension:
- GZip - requires PHP's "zlib" extension
- Bzip2 - requires PHP's "bzip2" extension
- Brotli - requires https://github.com/kjdev/php-ext-brotli
- Snappy - no dependencies, implemented in userland
- ZStandard - requires https://github.com/kjdev/php-ext-zstd
Accessing these algorithms can be done via the Compression
API:
Continuing the above example using streams:
Discovering supported algorithms can be done using the Compression
API:
...or as a one-line shell command:
Advanced example
Fetching a given URL using HTTP Accept-Encoding and Content-Encoding:
See also
- The PHP RFC Modern Compression suggests adding zstd and brotli into PHP.
- Snappy does not aim for maximum compression, or compatibility with any other compression library; instead, it aims for very high speeds and reasonable compression, quoting its Wikipedia page