Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
Oct 31, 2021
Nov 5, 2021
Oct 31, 2021
Nov 5, 2021
Nov 5, 2021
Oct 31, 2021

Slam / flysystem-compress-and-encrypt-proxy

Latest Stable Version Downloads Integrate Code Coverage Type Coverage Infection MSI

Compress and Encrypt files and streams before saving them to the final Flysystem destination.

Installation

To install with composer run the following command:

$ composer require slam/flysystem-compress-and-encrypt-proxy

Usage

use SlamCompressAndEncryptProxy\CompressAndEncryptAdapter;
use League\Flysystem\AwsS3V3\AwsS3V3Adapter;

// Create a strong key and save it somewhere
$key = EncryptedZipProxyAdapter::generateKey();

// Create the final FilesystemAdapter, for example Aws S3
$remoteAdapter = new AwsS3V3Adapter(/* ... */);

$adapter = new CompressAndEncryptAdapter(
    $remoteAdapter,
    $key
);

// The FilesystemOperator
$filesystem = new \League\Flysystem\Filesystem($adapter);

$handle = fopen('my-huge-file.txt', 'r');
$filesystem->writeStream('data.txt', $handle);
fclose($handle);

Streams

Both write and read operations leverage streams to keep memory usage low.

Compression

GZip's zlib.deflate and zlib.inflate compression filters are used.

Encryption

Sodium extension provides the backend for the encrypted stream with XChaCha20-Poly1305 algorithm.

About

No description, website, or topics provided.

Resources

License

Code of conduct

Releases

No releases published

Packages

No packages published