Simple wrapper that provides a common interface for data compression. Making easy to change the compression algorithm and use a common interface.
- PHP >= 5.4
The recommended way to install is through composer.
Just create a composer.json
file for your project:
{
"require": {
"ebidtech/compress": "@stable"
}
}
Tip: browse ebidtech/compress
page to choose a stable version to use, avoid the @stable
meta constraint.
And run these two commands to install it:
$ curl -sS https://getcomposer.org/installer | php
$ composer install
Now you can add the autoloader, and you will have access to the library:
<?php
require 'vendor/autoload.php';
use EBT\Compress\CompressBuilder;
$compressor = CompressBuilder::create()->get('gzencode');
$compressedData = $compressor->compress('some text');
echo $compressor->uncompress($compressedData); // will print 'some text'
use EBT\Compress\GzcompressCompressor as Compressor;
$compressor = new Compressor();
$compressedData = $compressor->compress('some text');
echo $compressor->uncompress($compressedData); // will print 'some text'
use EBT\Compress\GzcompressCompressorTrait as CompressorTrait;
class Test
{
use CompressorTrait;
public function test()
{
$compressedData = $this->compress('test');
echo $this->uncompress($compressedData); // will print 'some text'
}
}
See CONTRIBUTING file.
- Ebidtech developer team, compress Lead developer Eduardo Oliveira ([email protected]).
- All contributors
Compress library is released under the MIT License. See the bundled LICENSE file for details.