aboutsummaryrefslogtreecommitdiff
path: root/examples/05-send.php
diff options
context:
space:
mode:
Diffstat (limited to 'examples/05-send.php')
-rw-r--r--examples/05-send.php14
1 files changed, 14 insertions, 0 deletions
diff --git a/examples/05-send.php b/examples/05-send.php
new file mode 100644
index 0000000..93b4b27
--- /dev/null
+++ b/examples/05-send.php
@@ -0,0 +1,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!');
+});