Zstd Extension for PHP
PHP C M4
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
tests Updated test Apr 5, 2018
zstd @ 2555975 Updated library Zstandard v1.3.4 Apr 4, 2018
.gitignore add --with-libzstd option to use system library Jan 30, 2018
.gitmodules Updated library Zstandard v1.0 Sep 1, 2016
.travis.yml Added PHP 7.2 of Travis CI Apr 5, 2018
LICENSE Init project Apr 29, 2015
LICENSE-zstd
README.md Updated README.md Apr 5, 2018
config.m4 Minor typo in config.m4 May 7, 2018
php_zstd.h Updated version to 0.4.14 May 8, 2018
zstd.c Corresponds to negative compression level Apr 5, 2018

README.md

Zstd Extension for PHP

Build Status

This extension allows Zstandard.

Documentation for Zstandard can be found at » https://github.com/facebook/zstd.

Build from sources

% git clone --recursive --depth=1 https://github.com/kjdev/php-ext-zstd.git
% phpize
% ./configure
% make
% make install

To use the system library

% ./configure --with-libzstd

Distribution binary packages

Fedora / CentOS / RHEL

RPM packages of this extension are available in » Remi's RPM repository and are named php-zstd.

Configration

zstd.ini:

extension=zstd.so

Function

  • zstd_compress — Zstandard compression
  • zstd_uncompress — Zstandard decompression
  • zstd_compress_dict — Zstandard compression using a digested dictionary
  • zstd_uncompress_dict — Zstandard decompression using a digested dictionary

zstd_compress — Zstandard compression

Description

string zstd_compress ( string $data [, int $level = 3 ] )

Zstandard compression.

Pameters

  • data

    The string to compress.

  • level

    The level of compression (1-22). (Defaults to 3, 0 for no compression)

    A value smaller than 0 means a faster compression level. (Zstandard library 1.3.4 or later)

Return Values

Returns the compressed data or FALSE if an error occurred.

zstd_uncompress — Zstandard decompression

Description

string zstd_uncompress ( string $data )

Zstandard decompression.

Alias: zstd_decompress

Pameters

  • data

    The compressed string.

Return Values

Returns the decompressed data or FALSE if an error occurred.

zstd_compress_dict — Zstandard compression using a digested dictionary

Description

string zstd_compress_dict ( string $data , string $dict )

Zstandard compression using a digested dictionary.

Alias: zstd_compress_usingcdict

Pameters

  • data

    The string to compress.

  • dict

    The Dictionary data.

Return Values

Returns the compressed data or FALSE if an error occurred.

zstd_uncompress_dict — Zstandard decompression using a digested dictionary

Description

string zstd_uncompress_dict ( string $data , string $dict )

Zstandard decompression using a digested dictionary.

Alias: zstd_dempress_dict, zstd_unmpress_usingcdict, zstd_decompress_usingcdict

Pameters

  • data

    The compressed string.

  • dict

    The Dictionary data.

Return Values

Returns the decompressed data or FALSE if an error occurred.

Namespace

Namespace Zstd;

function compress( $data [, $level = 3 ] )
function uncompress( $data )
function compress_dict ( $data, $dict )
function uncompress_dict ( $data, $dict )

zstd_compress, zstd_uncompress, zstd_compress_dict and zstd_uncompress_dict function alias.

Examples

$data = zstd_compress('test');
zstd_uncompress($data);