Skip to content

kjdev/php-ext-snappy

Repository files navigation

Snappy Extension for PHP

Linux Windows

This extension allows Snappy.

Documentation for Snappy can be found at » http://google.github.io/snappy/.

Build from sources

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

To use the system library

./configure --with-snappy-includedir=/usr

Distribution binary packages

Fedora / CentOS / RHEL

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

Configuration

php.ini:

extension=snappy.so

Function : snappy_compress()

string snappy_compress( string $data )

parameters

data:

The data to compress.

return values

The compressed string or FALSE if an error occurred.

Function : snappy_uncompress()

string snappy_uncompress( string $data )

parameters

name:

The data compressed by snappy_compress(). 

return values

The original uncompressed data or FALSE on error.

Example

$compressed = snappy_compress('Compress me');

$uncompressed = snappy_uncompress($compressed);

echo $uncompressed;

Troubleshooting

Ubuntu / OSX

Snappy requires C++ and therefore might require for you to install the g++ or build-essential package.

If you get an error about "this file requires compiler and library support" or compilation errors on OSX, you need to enforce the compilation with -std=c++11 flag:

export CXXFLAGS=-std=c++11
phpize
./configure
make

About

Snappy Extension for PHP

Resources

License

Unknown, Unknown licenses found

Licenses found

Unknown
LICENSE
Unknown
COPYING.snappy

Stars

Watchers

Forks

Packages

No packages published