123456789101112131415161718192021222324252627282930313233 |
- Usage with FlySystem
- ===============
- For saving or uploading the generated zip, you can use the
- `Flysystem <https://flysystem.thephpleague.com>`_ package, and its many
- adapters.
- For that you will need to provide another stream than the ``php:
- default one, and pass it to Flysystem ``putStream`` method.
- .. code-block:: php
-
-
- $tempStream = fopen('php://memory', 'w+');
-
- $zipStreamOptions = new Archive();
- $zipStreamOptions->setOutputStream($tempStream);
-
- $zipStream = new ZipStream('test.zip', $zipStreamOptions);
- $zipStream->addFile('test.txt', 'text');
- $zipStream->finish();
-
- $adapter = new Local(__DIR__.'/path/to/folder');
- $filesystem = new Filesystem($adapter);
- $filesystem->putStream('test.zip', $tempStream)
-
- fclose($tempStream);
|