v2.0.0
v2.0.0 — Incremental Compression & Decompression
This release adds a full incremental streaming API, mirroring zlib's DeflateContext / InflateContext pattern, plus a major internal refactor and expanded test coverage.
Incremental API
Two new context classes with factory, feed, and finish functions:
// Encode
$ctx = xz_encode_init(XZ_CHECK_CRC64, ['level' => 6]);
$out = xz_encode_add($ctx, 'Hello, ');
$out .= xz_encode_add($ctx, 'World!');
$out .= xz_encode_finish($ctx);
// Decode
$ctx = xz_decode_init(XZ_CONCATENATED);
$dec = xz_decode_add($ctx, $compressed);
$dec .= xz_decode_finish($ctx);
$status = xz_decode_get_status($ctx); // 1 = finished
$bytes = xz_decode_get_read_len($ctx); // compressed bytes consumed8 new functions: xz_encode_init, xz_encode_add, xz_encode_finish, xz_decode_init, xz_decode_add, xz_decode_finish, xz_decode_get_status, xz_decode_get_read_len
7 new constants: XZ_CHECK_NONE, XZ_CHECK_CRC32, XZ_CHECK_CRC64, XZ_CHECK_SHA256, XZ_FAIL_FAST, XZ_IGNORE_CHECK, XZ_CONCATENATED
Internal refactor
- Codebase split into one-file-per-concept (
xz_encode.c,xz_decode.c,xz_encode_context.c,xz_decode_context.c,xz_fopen_wrapper.c) - All version guards consolidated in
xz_compat.h - Argument parsing migrated to ZEND_PARSE_PARAMETERS_START / Z_PARAM_* macros
- Fixed memory leak on lzma_end in encoder error paths