Robot
ce55b353ec
Remove all backward compatibility issues, so JCB will not need the [Backward Compatibility] plugin to run. Added new import powers for custom import of spreadsheets. Move the setDocument and _prepareDocument above the display in the site view and custom admin view. Update the trashhelper layout to work in Joomla 5. Add AllowDynamicProperties (Joomla 4+5) to view class to allow Custom Dynamic Get methods to work without issues.
35 lines
1.1 KiB
ReStructuredText
35 lines
1.1 KiB
ReStructuredText
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://output``
|
|
default one, and pass it to Flysystem ``putStream`` method.
|
|
|
|
.. code-block:: php
|
|
|
|
// Open Stream only once for read and write since it's a memory stream and
|
|
// the content is lost when closing the stream / opening another one
|
|
$tempStream = fopen('php://memory', 'w+');
|
|
|
|
// Create Zip Archive
|
|
$zipStream = new ZipStream(
|
|
outputStream: $tempStream,
|
|
outputName: 'test.zip',
|
|
);
|
|
$zipStream->addFile('test.txt', 'text');
|
|
$zipStream->finish();
|
|
|
|
// Store File
|
|
// (see Flysystem documentation, and all its framework integration)
|
|
// Can be any adapter (AWS, Google, Ftp, etc.)
|
|
$adapter = new Local(__DIR__.'/path/to/folder');
|
|
$filesystem = new Filesystem($adapter);
|
|
|
|
$filesystem->writeStream('test.zip', $tempStream)
|
|
|
|
// Close Stream
|
|
fclose($tempStream);
|