PHPackages                             mateuszanella/php-ext-xz - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. mateuszanella/php-ext-xz

ActivePhp-ext[Utility &amp; Helpers](/categories/utility)

mateuszanella/php-ext-xz
========================

A PHP Extension providing xz (LZMA2) compression/decompression via PHP streams.

v1.2.0(7mo ago)361[1 issues](https://github.com/mateuszanella/php-ext-xz/issues)PHP-3.01CCI passing

Since Sep 18Pushed 7mo agoCompare

[ Source](https://github.com/mateuszanella/php-ext-xz)[ Packagist](https://packagist.org/packages/mateuszanella/php-ext-xz)[ Docs](https://github.com/mateuszanella/php-ext-xz)[ RSS](/packages/mateuszanella-php-ext-xz/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)DependenciesVersions (5)Used By (0)

php-ext-xz
==========

[](#php-ext-xz)

PHP Extension providing XZ (LZMA2) compression/decompression functions.

Installation
------------

[](#installation)

The recommended way to install the extension is using [pie](https://www.php.net/manual/en/install.pie.intro.php):

```
pie install mateuszanella/php-ext-xz
```

This will download the source and compile the extension for your current PHP version. After installing the module, you may need to enable it in your `php.ini` file.

---

Configuration
-------------

[](#configuration)

### php.ini

[](#phpini)

Add the following line to your `php.ini` configuration file:

```
extension=xz.so
```

You can also configure the default compression level and memory limit:

```
; Default compression level. Affects `xzencode` and `xzopen`,
; but only when the level was not specified. Default is 5.
xz.compression_level=5

; The maximum amount of memory that can be used when decompressing. Default is 0 (no limit).
xz.max_memory=65536
```

Build from Source
-----------------

[](#build-from-source)

For detailed build and installation instructions from source, please see [docs/BUILD.md](docs/BUILD.md).

Basic usage
-----------

[](#basic-usage)

### String-based operations

[](#string-based-operations)

You can easily compress and decompress strings.

```
$originalString = 'This is a test string that will be compressed and then decompressed.';

// Compress a string
$compressed = xzencode($originalString);

// Decompress a string
$decompressed = xzdecode($compressed);
```

### File-based operations

[](#file-based-operations)

The extension also supports stream-based operations for working with `.xz` files.

```
$file = '/tmp/test.xz';

// Writing to an .xz file
$wh = xzopen($file, 'w');
xzwrite($wh, 'Data to write');
xzclose($wh);

// Reading from an .xz file and outputting its contents
$rh = xzopen($file, 'r');
xzpassthru($rh);
xzclose($rh);
```

Credits
-------

[](#credits)

This repository is a fork from [php-ext-xz by codemasher](https://github.com/codemasher/php-ext-xz), originally forked from the [RFC](https://news-web.php.net/php.internals/106654).

You can see the full list of contributors [here](https://github.com/mateuszanella/php-ext-xz/graphs/contributors).

###  Health Score

30

—

LowBetter than 65% of packages

Maintenance57

Moderate activity, may be stable

Popularity9

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 Bus Factor1

Top contributor holds 69.3% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~3 days

Total

3

Last Release

226d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/49a41410f346422fe66201d196a321b3da5717135ae2d1891479781353cc450f?d=identicon)[mateuszanella](/maintainers/mateuszanella)

---

Top Contributors

[![codemasher](https://avatars.githubusercontent.com/u/592497?v=4)](https://github.com/codemasher "codemasher (88 commits)")[![udan11](https://avatars.githubusercontent.com/u/4147664?v=4)](https://github.com/udan11 "udan11 (13 commits)")[![remicollet](https://avatars.githubusercontent.com/u/270445?v=4)](https://github.com/remicollet "remicollet (11 commits)")[![mateuszanella](https://avatars.githubusercontent.com/u/39682511?v=4)](https://github.com/mateuszanella "mateuszanella (10 commits)")[![nbianca](https://avatars.githubusercontent.com/u/23153890?v=4)](https://github.com/nbianca "nbianca (2 commits)")[![shivammathur](https://avatars.githubusercontent.com/u/1571086?v=4)](https://github.com/shivammathur "shivammathur (2 commits)")[![chobie](https://avatars.githubusercontent.com/u/195038?v=4)](https://github.com/chobie "chobie (1 commits)")

---

Tags

compressionlzmaphpxzphp-extensionlzma2xz

### Embed Badge

![Health badge](/badges/mateuszanella-php-ext-xz/health.svg)

```
[![Health](https://phpackages.com/badges/mateuszanella-php-ext-xz/health.svg)](https://phpackages.com/packages/mateuszanella-php-ext-xz)
```

###  Alternatives

[grumpydictator/firefly-iii

Firefly III: a personal finances manager.

22.8k69.3k](/packages/grumpydictator-firefly-iii)[rubix/tensor

A library and extension that provides objects for scientific computing in PHP.

2751.4M5](/packages/rubix-tensor)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
