aboutsummaryrefslogtreecommitdiff
path: root/examples/05-send.php
blob: 93b4b277cd315983f5f7dd0cb099022f777dc92f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<?php
declare(strict_types = 1);

require_once __DIR__ . '/../src/ZipStream.php';

# import zipstream class
use Pablotron\ZipStream\ZipStream;

# create archive named "example.zip"
ZipStream::send('example.zip', function(ZipStream &$zip) {
  # add a file named "hello.txt" to output archive, containing
  # the string "hello world!"
  $zip->add_file('hello.txt', 'hello world!');
});