maennchen/zipstream-php
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|
The maennchen/zipstream-php package is a PHP library designed for streaming zip files dynamically. It offers a faster, disk-saving method of working with zipped files, as it eliminates the need to write zip files to the disk on your server. Furthermore, it's compatible with S3 buckets and any PSR7 Stream. The package is an ideal solution for applications that need to rapidly download zip files without affecting server performance.
To use maennchen/zipstream-php, you first need to install it via Composer, the dependency manager for PHP. You can add the package to your project's dependencies with the following command:
composer require maennchen/zipstream-php
Then, you can use it in your PHP code. Here's a basic example showing how to create a ZipStream object and add files:
// Autoload the dependencies
require 'vendor/autoload.php';
// create a new zipstream object
$zip = new ZipStream\ZipStream(
outputName: 'example.zip',
sendHttpHeaders: true, // enable output of HTTP headers
);
// create a file named 'hello.txt'
$zip->addFile(
fileName: 'hello.txt',
data: 'This is the contents of hello.txt',
);
// add a file named 'some_image.jpg' from a local file 'path/to/image.jpg'
$zip->addFileFromPath(
fileName: 'some_image.jpg',
path: 'path/to/image.jpg',
);
// finish the zip stream
$zip->finish();
The comprehensive documentation for maennchen/zipstream-php is readily available online. To access a detailed guide featuring install instructions, usage examples, troubleshooting advice, and more, visit https://maennchen.github.io/ZipStream-PHP/.