ebidtech / compress
Compress library
Installs: 9 732
Dependents: 2
Suggesters: 0
Security: 0
Stars: 3
Watchers: 16
Forks: 0
Open Issues: 0
Requires
- php: >=5.4.0
Requires (Dev)
- phpunit/phpunit: 3.7.*
- satooshi/php-coveralls: dev-master
README
Simple wrapper that provides a common interface for data compression. Making easy to change the compression algorithm and use a common interface.
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
- Ebidtech developer team, compress Lead developer Eduardo Oliveira (eduardo.oliveira@ebidtech.com).
- All contributors
License
Compress library is released under the MIT License. See the bundled LICENSE file for details.