PHP code example of dlintin / zipstream-php
1. Go to this page and download the library: Download dlintin/zipstream-php 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/ */
dlintin / zipstream-php example snippets
# Autoload the dependencies
bject
$zip = new ZipStream\ZipStream('example.zip');
# create a file named 'hello.txt'
$zip->addFile('some_image.jpg', 'This is the contents of hello.txt');
# add a file named 'image.jpg' from a local file 'path/to/image.jpg'
$zip->addFileFromPath('some_image.jpg', 'path/to/image.jpg');
# add a file named 'goodbye.txt' from an open stream resource
$fp = tmpfile();
fwrite($fp, 'The quick brown fox jumped over the lazy dog.');
$zip->addFileFromStream('goodbye.txt', $fp);
fclose($fp);
# finish the zip stream
$zip->finish();
https://github.com/maennchen/ZipStream-PHP