Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Zipstream Php Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Dynamic File Bundling: Enable on-demand generation of ZIP archives (e.g., user exports, bulk downloads) without disk I/O, reducing server load and improving scalability.
  • Performance Optimization: Replace legacy disk-based ZIP generation (e.g., ZipArchive) for high-traffic features (e.g., "Download All" buttons) to cut latency and resource usage.
  • Multi-Destination Streaming: Support use cases requiring simultaneous delivery to:
    • User browsers (HTTP headers auto-handled).
    • Cloud storage (S3, GCS) via PSR-7 streams.
    • Local backups or analytics pipelines via callback streams.
  • Cost Efficiency: Eliminate temporary disk storage for ZIPs, reducing cloud storage costs (e.g., S3 egress fees) and server disk wear.
  • Roadmap Prioritization:
    • Build vs. Buy: Justify internal development of custom ZIP logic if this package lacks critical features (e.g., per-file compression tuning).
    • Feature Expansion: Integrate with existing systems (e.g., Laravel’s Storage facade) to unify file handling.
    • Compliance: Address GDPR/privacy needs by avoiding persistent ZIP storage (e.g., for user data exports).

When to Consider This Package

Adopt if:

  • Your PHP app generates ZIPs dynamically (e.g., user-specific exports, real-time reports) and cannot afford disk I/O.
  • You need to stream ZIPs directly to users (e.g., large files >100MB) without buffering to disk.
  • Your stack uses PSR-7 streams (e.g., Symfony HTTP Foundation, AWS SDK) or requires multi-destination output (e.g., browser + S3).
  • You’re on PHP 8.1+ and can tolerate minor breaking changes (e.g., v3.x API shifts).
  • Security/compliance demands no temporary ZIP files (e.g., handling PII).

Look elsewhere if:

  • You need legacy PHP support (<8.1) or Windows compatibility (64-bit only).
  • Your use case requires advanced ZIP features (e.g., AES encryption, multi-volume splits) not supported here.
  • You’re already using a managed service (e.g., AWS Lambda layers, serverless functions) that handles ZIPs natively.
  • Your team lacks PHP stream/PSR-7 familiarity (steeper learning curve than ZipArchive).
  • You need fine-grained control over ZIP metadata (e.g., custom headers, per-file compression levels) beyond the package’s defaults.

How to Pitch It (Stakeholders)

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:

  • Performance: No temp files = lower CPU/memory usage and faster responses.
  • Flexibility: Works with PSR-7 streams (e.g., S3, HTTP responses) or custom callbacks.
  • Modern PHP: Clean API (named args, enums) and PHP 8.2+ support.
  • Extensible: Callback streams let you pipe ZIPs to multiple destinations (e.g., browser + analytics).

Migration Path:

  1. Replace ZipArchive calls with ZipStream\ZipStream.
  2. Use addFile() for in-memory data or addFileFromPath() for local files.
  3. Leverage 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."*

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament
leek/filament-subtenant-scope
anil/file-picker
broqit/fields-ai