cyberdummy / gzstream
Provide gzip file streams for guzzle and s3
Installs: 255 868
Dependents: 0
Suggesters: 0
Security: 0
Stars: 9
Watchers: 2
Forks: 1
Open Issues: 0
Requires
- aws/aws-sdk-php: ^3.2
- guzzlehttp/psr7: ^2
- psr/http-message: ^1.0
Requires (Dev)
- phpunit/phpunit: ^9
- vlucas/phpdotenv: ~2.0
This package is not auto-updated.
Last update: 2025-03-29 05:29:43 UTC
README
Provides additional stream wrappers for guzzle and S3 streams so you can read and write gzip files.
Installation with Composer
composer require cyberdummy/gzstream
Usage
Usage in guzzle, wrap the body stream in the new decorator.
use Cyberdummy\GzStream\GzStreamGuzzle; $newBodyStream = new GzStreamGuzzle($psr7BodyStream);
Usage with S3 stream wrapper.
use Cyberdummy\GzStream\GzS3Wrapper; $s3Client = new Aws\S3\S3Client([ 'version' => 'latest' ]); # Register the wrapper as "s3gz" GzS3Wrapper::register($s3Client, 's3gz'); # Stream a read $stream = fopen('s3gz://somebucket/somegzippedfile.txt.gz', 'r'); $line = fgets($stream, 1024); # Stream a write $stream = fopen('s3gz://somebucket/somegzippedfile.txt.gz', 'w'); fwrite($stream, "Something to compress"); fclose($stream);