ebidtech/compress

Compress library

Installs: 2 961

Dependents: 1

Stars: 2

Watchers: 14

Language: PHP

v1.1.1 2013-11-28 13:07 UTC

README

Simple wrapper that provides a common interface for data compression. Making easy to change the compression algorithm and use a common interface.

Latest Stable Version Build Status Coverage Status Scrutinizer Quality Score Dependency Status

Requirements

  • PHP >= 5.4

Installation

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';

Usage

Builder

use EBT\Compress\CompressBuilder;

$compressor = CompressBuilder::create()->get('gzencode');
$compressedData = $compressor->compress('some text');
echo $compressor->uncompress($compressedData); // will print 'some text'

Regular way

use EBT\Compress\GzcompressCompressor as Compressor;

$compressor = new Compressor();
$compressedData = $compressor->compress('some text');
echo $compressor->uncompress($compressedData); // will print 'some text'

Traits

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'
    }
}

Contributing

See CONTRIBUTING file.

Credits

License

Compress library is released under the MIT License. See the bundled LICENSE file for details.