Git Product home page Git Product logo

php-ext-lz4's Introduction

LZ4 Extension for PHP

Linux Windows

This extension allows LZ4.

Documentation for LZ4 can be found at » https://github.com/Cyan4973/lz4.

Build from sources

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

To use the system library

% ./configure --with-lz4-includedir=/usr

Distribution binary packages

Fedora / CentOS / RHEL

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

Debian

DEB packages of this extension are available in » Ondřej Surý's DEB repository and are named php-lz4.

Configuration

php.ini:

extension=lz4.so

Function

  • lz4_compress — LZ4 compression
  • lz4_uncompress — LZ4 decompression

lz4_compress — LZ4 compression

Description

string lz4_compress ( string $data [ , int $level = 0 , string $extra = NULL ] )

LZ4 compression.

Pameters

  • data

    The string to compress.

  • level

    The level of compression (1-12, Recommended values are between 4 and 9). (Default to 0, Not High Compression Mode.)

  • extra

    Prefix to compressed data.

Return Values

Returns the compressed data or FALSE if an error occurred.

lz4_uncompress — LZ4 decompression

Description

string lz4_uncompress ( string $data [ , long $maxsize = -1 , long $offset = -1 ] )

LZ4 decompression.

Pameters

  • data

    The compressed string.

  • maxsize

    Allocate size output data.

  • offset

    Offset to decompressed data.

Return Values

Returns the decompressed data or FALSE if an error occurred.

Examples

$data = lz4_compress('test');

lz4_uncompress($data);

Compress Data

Default

$data = lz4_compress('test')

compress-default

Extra prefix data

$data = lz4_compress('test', false, 'PREFIX')

compress-extra

Uncompress Data

Default

lz4_uncompress($data);

uncompress-default

Offset

lz4_uncompress($data, 256, 6);

uncompress-offset

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.