PHP code example of ebidtech / compress

1. Go to this page and download the library: Download ebidtech/compress library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ebidtech / compress example snippets





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