aboutsummaryrefslogtreecommitdiff
path: root/examples/03-add_stream.php
blob: 68895b326fe53c61bbbc792536ff555ff80af4dd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?php

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

# import zipstream class
use Pablotron\ZipStream\ZipStream;

# set source path
$src_path = __DIR__ . '/03-add_stream.php';

# create the output archive named "example.zip"
$zip = new ZipStream('example.zip');

# open stream
$src = fopen($src_path, 'rb');

# read from source stream and add it to the archive as "example.php"
$zip->add_stream('example.php', $src);

# close input stream
fclose($src);

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