This extension allows LZ4.
Documentation for LZ4 can be found at » https://github.com/Cyan4973/lz4.
% git clone --recursive --depth=1 https://github.com/kjdev/php-ext-lz4.git
% cd php-ext-lz4
% phpize
% ./configure
% make
% make install
To use the system library
% ./configure --with-lz4-includedir=/usrRPM packages of this extension are available in » Remi's RPM repository and are named php-lz4.
DEB packages of this extension are available in » Ondřej Surý's DEB repository and are named php-lz4.
pie install kjdev/lz4php.ini:
extension=lz4.so
- lz4_compress — LZ4 compression (block format)
- lz4_uncompress — LZ4 decompression (block format)
- lz4_compress_frame — LZ4 compression (frame format)
- lz4_uncompress_frame — LZ4 decompression (frame format)
string lz4_compress ( string $data [ , int $level = 0 , string $extra = NULL ] )
LZ4 compression.
-
data
The string to compress.
-
level
The level of compression (1-12, Recommended values are between 4 and 9). (Default to 0, Not High Compression Mode.)
-
extra
Prefix to compressed data.
Returns the compressed data or FALSE if an error occurred.
string lz4_uncompress ( string $data [ , long $maxsize = -1 , long $offset = -1 ] )
LZ4 decompression.
-
data
The compressed string.
-
maxsize
Allocate size output data.
-
offset
Offset to decompressed data.
Returns the decompressed data or FALSE if an error occurred.
string lz4_compress_frame ( string $data [ , int $level = 0 , int $max_block_size = 0 , int $checksums = 0 ] )
LZ4 compression to frame.
-
data
The string to compress.
-
level
The level of compression (1-12, Recommended values are between 4 and 9). (Default to 0, Not High Compression Mode.)
-
max_block_size
Maximum uncompressed size of each block. Pass any of the following values:
- LZ4_BLOCK_SIZE_64KB
- LZ4_BLOCK_SIZE_256KB
- LZ4_BLOCK_SIZE_1MB
- LZ4_BLOCK_SIZE_4MB
Any other value will be treated as LZ4_BLOCK_SIZE_64KB.
-
checksums
Enable/disable frame-level and block-level checksums. Pass a bitwise combination of the following constants:
- LZ4_CHECKSUM_FRAME: frame-level checksum
- LZ4_CHECKSUM_BLOCK: block-level checksum
Returns the compressed data or FALSE if an error occurred.
string lz4_uncompress_frame ( string $data )
LZ4 decompression from frame.
-
data
The compressed string.
Returns the decompressed data or FALSE if an error occurred.
$data = lz4_compress('test');
lz4_uncompress($data);
$data = lz4_compress('test')
$data = lz4_compress('test', false, 'PREFIX')
lz4_uncompress($data);
lz4_uncompress($data, 256, 6);



