summaryrefslogtreecommitdiff
path: root/examples/02-add_file_from_path.php
blob: 3b73754a32b013a78fead398a2b3a05b38b9f757 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?php

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

# import zipstream class
use Pablotron\ZipStream\ZipStream;

# set source path of local file
$src_path = __DIR__ . '/02-add_file_from_path.php';

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

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

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