Skip to content

Commit

Permalink
Update usage for maennchen/zipstream-php
Browse files Browse the repository at this point in the history
  • Loading branch information
odan committed Nov 4, 2023
1 parent a41d619 commit ec96a15
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,20 +158,19 @@ $zip->finish();
$response = $zipResponder->withZipStream($response, $stream, 'download.zip');
```

Sending a zipstream on the fly:
Sending a ZIP-stream on the fly:

```php
use Selective\Http\Zip\Stream\CallbackStream;
use ZipStream\Option\Archive;
use ZipStream\ZipStream;
//...

$callbackStream = new CallbackStream(function () {
$archive = new Archive();

// Flush ZIP file directly to output stream (php://output)
$archive->setFlushOutput(true);
$zip = new ZipStream(null, $archive);
$zip = new ZipStream(
flushOutput: true,
sendHttpHeaders: false,
);

// Add files to ZIP file and stream it directly
$zip->addFile('test.txt', 'my file content');
Expand Down

0 comments on commit ec96a15

Please sign in to comment.