blob: 84bd71bacbff412b9e31816c92683006a3f962ef (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
<?php
declare(strict_types = 1);
require_once __DIR__ . '/../src/ZipStream.php';
# import zipstream classes
use Pablotron\ZipStream\ZipStream;
use Pablotron\ZipStream\FileWriter;
# output zip file
$zip_path = __DIR__ . '/example-11.zip';
$zip_args = [
'output' => new FileWriter(),
];
# create archive in this directory with a comment
ZipStream::send($zip_path, function(ZipStream &$zip) {
# add a file "hello.txt" to output with a comment
$zip->add_file('hello.txt', 'hello world!', [
'comment' => 'hello this is a comment!',
]);
}, $zip_args);
|