/php-xz

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

Primary LanguageCOtherNOASSERTION

php-xz

Build Status

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

Installation

To install as module, perform the following steps:

git clone https://github.com/udan11/php-xz
cd php-xz && phpize && ./configure && make && sudo make install

Do not forget to add extension = xz.so to your php.ini.

Requirements

This module depends on git, php5-dev and liblzma-dev. If you are using Ubuntu, you can easily install all of them by typing the following command in your terminal:

sudo apt-get install git php5-dev liblzma-dev

Basic usage

<?php

$fh = xzopen("/tmp/test.xz", "w");
xzwrite($fh, "Data you would like compressed and written.\n");
xzclose($fh);

$fh = xzopen("/tmp/test.xz", "r");
xzpassthru($fh);
xzclose($fh);