PHP code example of pinimize / laravel-lzf-compresssion
1. Go to this page and download the library: Download pinimize/laravel-lzf-compresssion 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/ */
pinimize / laravel-lzf-compresssion example snippets
use Illuminate\Support\Str;
use Illuminate\Support\Facades\Storage;
use Pinimize\Facades\Compression;
use Pinimize\Facades\Decompression;
// When you have made lzf the default driver in your configuration:
$compressedStringZlib = Str::compress($originalString);
$decompressedStringGzip = Str::decompress($compressedStringGzip);
// By specifying the driver:
$compressedStringZlib = Str::compress($originalString, 'lzf');
$decompressedStringGzip = Str::decompress($compressedStringGzip, 'lzf');
// Or with the Storage facade:
Storage::compress('/path/to/original.json', '/path/to/compressed.json.lzf');
Storage::decompress('/path/to/compressed.json.lzf', '/path/to/decompressed.json');
// Compress a string using LZF
$compressed = Compression::driver('lzf')->string('Hello, World!');
// Default driver
$compressed = Compression::string('Hello, World!');
Compression::put('path/to/compressed.csv.lzf', '/path/to/original.csv');