Skip to content
This repository was archived by the owner on Nov 7, 2025. It is now read-only.

nerou42/php-ext-lz4frame

Repository files navigation

LZ4 extension for PHP supporting Block and Frame format

Note

The pull request to add LZ4 Frame format support to kjdev/lz4 has been merged, such that it supports the LZ4 Frame format since version 0.6.0. Therefore and because this repository does not support compression levels, this repository is obsolete.

This extension adds support for the LZ4 compression algorithm.

Unlike kjdev/lz4, this extension...

  • is based on lz4_flex rather than Cyan4973's LZ4
  • supports the LZ4 Frame format, which adds checksums, magic bytes etc.
  • does not (yet) support compression levels, since lz4_flex does not

Install

It is recommended to install this extension via PIE:

pie install nerou/lz4frame

Usage

Have a look at the stubs file to see the API.

If you are wondering what the block vs. frame formats are, have a look at Block Format and Frame Format. Short version: While the Block format is just the compressed data in a more or less raw variant, the Frame format adds a header and footer around it, which contain magic bytes, checksums, length information etc. Therefore, the Frame format is much easier to recognize as being LZ4 compressed data compared to the Block format and you get better integrity due to the (optional) checksums.

License

This project is licensed under the MIT license.

About

LZ4 extension for PHP supporting block and frame format

Topics

Resources

License

Stars

Watchers

Forks