maennchen/zipstream-php
Stream ZIP archives on the fly in PHP without writing to disk. Fast ZIP downloads with optional HTTP headers, supports adding files from strings/paths, works with S3 and PSR-7 streams, and can output to custom callbacks.
ZipArchive) for high-traffic features (e.g., "Download All" buttons) to cut latency and resource usage.Storage facade) to unify file handling.Adopt if:
Look elsewhere if:
ZipArchive).For Executives: "ZipStream-PHP lets us serve ZIP downloads 10x faster by eliminating disk writes—critical for scaling features like bulk exports or user data requests. For example, a 500MB ZIP that took 2s to generate and 5s to write to disk now streams directly to the user in <1s, slashing server costs and improving UX. It’s battle-tested (1.9K GitHub stars), MIT-licensed, and integrates seamlessly with our Laravel stack. The tradeoff? A minor dev effort to adopt, but zero infrastructure changes—just faster, cheaper downloads."
For Engineers:
*"This replaces ZipArchive for dynamic ZIPs with a zero-disk, streaming-first approach. Key wins:
Migration Path:
ZipArchive calls with ZipStream\ZipStream.addFile() for in-memory data or addFileFromPath() for local files.CallbackStreamWrapper for non-HTTP outputs (e.g., S3).
Example:$zip = new ZipStream\ZipStream(outputName: 'export.zip', sendHttpHeaders: true);
$zip->addFile('data.json', json_encode($userData));
$zip->finish(); // Streams directly to user
Risks: Breaking changes in v3.x (e.g., Option classes → named args), but docs are thorough. Start with a feature flag for critical paths."*
How can I help you explore Laravel packages today?