Skip to content

Commit 46b875a

Browse files
committed
Merge branch 'master' of github.com:cracksalad/php-ext-lz4 into cracksalad-master
2 parents f3faf6e + 550563e commit 46b875a

6 files changed

Lines changed: 444 additions & 3 deletions

File tree

README.md

Lines changed: 74 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ RPM packages of this extension are available in [» Remi's RPM repository](https
3333

3434
DEB packages of this extension are available in [» Ondřej Surý's DEB repository](https://deb.sury.org/) and are named **php-lz4**.
3535

36+
## Installation via PIE
37+
38+
```bash
39+
pie install kjdev/lz4
40+
```
41+
3642

3743
## Configuration
3844

@@ -42,8 +48,10 @@ php.ini:
4248

4349
## Function
4450

45-
* lz4\_compress — LZ4 compression
46-
* lz4\_uncompress — LZ4 decompression
51+
* lz4\_compress — LZ4 compression (block format)
52+
* lz4\_uncompress — LZ4 decompression (block format)
53+
* lz4\_compress\_frame — LZ4 compression (frame format)
54+
* lz4\_uncompress\_frame — LZ4 decompression (frame format)
4755

4856
### lz4\_compress — LZ4 compression
4957

@@ -99,6 +107,70 @@ LZ4 decompression.
99107

100108
Returns the decompressed data or FALSE if an error occurred.
101109

110+
111+
### lz4\_compress\_frame — LZ4 compression (frame format)
112+
113+
#### Description
114+
115+
string **lz4\_compress\_frame** ( string _$data_ [ , int _$level_ = 0 , int _$max_block_size_ = 0 , int _$checksums_ = 0 ] )
116+
117+
LZ4 compression to frame.
118+
119+
#### Pameters
120+
121+
* _data_
122+
123+
The string to compress.
124+
125+
* _level_
126+
127+
The level of compression (1-12, Recommended values are between 4 and 9).
128+
(Default to 0, Not High Compression Mode.)
129+
130+
* _max\_block\_size_
131+
132+
Maximum uncompressed size of each block.
133+
Pass any of the following values:
134+
135+
* _LZ4\_BLOCK\_SIZE\_64KB_
136+
* _LZ4\_BLOCK\_SIZE\_256KB_
137+
* _LZ4\_BLOCK\_SIZE\_1MB_
138+
* _LZ4\_BLOCK\_SIZE\_4MB_
139+
140+
Any other value will be treated as _LZ4\_BLOCK\_SIZE\_64KB_.
141+
142+
* _checksums_
143+
144+
Enable/disable frame level and block level checksums.
145+
Pass a bitwise combination of the following constants:
146+
147+
* _LZ4\_CHECKSUM\_FRAME_: frame level checksum
148+
* _LZ4\_CHECKSUM\_BLOCK_: block level checksum
149+
150+
#### Return Values
151+
152+
Returns the compressed data or FALSE if an error occurred.
153+
154+
155+
### lz4\_uncompress\_frame — LZ4 decompression (frame format)
156+
157+
#### Description
158+
159+
string **lz4\_uncompress\_frame** ( string _$data_ )
160+
161+
LZ4 decompression from frame.
162+
163+
#### Pameters
164+
165+
* _data_
166+
167+
The compressed string.
168+
169+
#### Return Values
170+
171+
Returns the decompressed data or FALSE if an error occurred.
172+
173+
102174
## Examples
103175

104176
$data = lz4_compress('test');

config.m4

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ if test "$PHP_LZ4" != "no"; then
5959
else
6060
AC_MSG_RESULT(use bundled version)
6161

62-
PHP_NEW_EXTENSION(lz4, lz4.c lz4/lib/lz4.c lz4/lib/lz4hc.c lz4/lib/xxhash.c, $ext_shared)
62+
PHP_NEW_EXTENSION(lz4, lz4.c lz4/lib/lz4.c lz4/lib/lz4hc.c lz4/lib/lz4frame.c lz4/lib/xxhash.c, $ext_shared)
6363

6464
PHP_ADD_BUILD_DIR($ext_builddir/lz4/lib, 1)
6565
PHP_ADD_INCLUDE([$ext_srcdir/lz4/lib])

0 commit comments

Comments
 (0)