aboutsummaryrefslogtreecommitdiff
path: root/examples/01-simple.php
blob: 7b4d450dbfeb60876510709cb2b1fab0ccfe5c3f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<?php

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

# import zipstream class
use Pablotron\ZipStream\ZipStream;

# create the output stream
# this will send the archive as an HTTP response by default
$zip = new ZipStream('example.zip');

# add "hello.txt" to output archive, containing
# the string "hello world!"
$zip->add_file('hello.txt', 'hello world!');

# finalize the output stream
$zip->close();