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=/usr
RPM 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.
php.ini:
extension=lz4.so
- lz4_compress — LZ4 compression
- lz4_uncompress — LZ4 decompression
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.
$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);