diff options
author | Paul Duncan <pabs@pablotron.org> | 2018-09-02 13:16:16 -0400 |
---|---|---|
committer | Paul Duncan <pabs@pablotron.org> | 2018-09-03 09:54:38 -0400 |
commit | b520b6459d7b5a3dfb31c1b3febf02887bb07505 (patch) | |
tree | c16e7f3c264280f90de2120b7f6ea7d5a914256d /examples/02-add_file_from_path.php | |
parent | ca87bd7c79c17af6cdf804bc24f58fb20c41ad76 (diff) | |
download | zipstream-php-b520b6459d7b5a3dfb31c1b3febf02887bb07505.tar.bz2 zipstream-php-b520b6459d7b5a3dfb31c1b3febf02887bb07505.zip |
add examples
Diffstat (limited to 'examples/02-add_file_from_path.php')
-rw-r--r-- | examples/02-add_file_from_path.php | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/examples/02-add_file_from_path.php b/examples/02-add_file_from_path.php new file mode 100644 index 0000000..3b73754 --- /dev/null +++ b/examples/02-add_file_from_path.php @@ -0,0 +1,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(); |