wamania/zip-streamed-response-bundle 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

wamania/zip-streamed-response-bundle

最新稳定版本:1.0

Composer 安装命令:

composer require wamania/zip-streamed-response-bundle

包简介

A symfony Response to build and stream Zip on the fly

README 文档

README

Largely inspired by ZipStream-PHP, PHPZip and of course, the ZIP specifications.

Installation

Require wamania/zip-streamed-response-bundle into your composer.json file:

{ "require": { "wamania/zip-streamed-response-bundle": "dev-master" } }

Register the bundle in app/AppKernel.php:

// app/AppKernel.php public function registerBundles() { return array( // ... new Wamania\ZipStreamedResponseBundle\ZipStreamedResponseBundle(), ); }

Usage

In your controller :

// .... use Wamania\ZipStreamedResponseBundle\Response\ZipStreamer\ZipStreamer; use Wamania\ZipStreamedResponseBundle\Response\ZipStreamer\ZipStreamerFile; use Wamania\ZipStreamedResponseBundle\Response\ZipStreamer\ZipStreamerBigFile; use Wamania\ZipStreamedResponseBundle\Response\ZipStreamedResponse; class DefaultController extends Controller { /**  * @Route("/", name="homepage")  */ public function indexAction() { $zipStreamer = new ZipStreamer('test.zip'); // Auto switch files above switchAboveSize to "big files" ZipStreamer::setAutoSwitch(false/true); // default = true // If autoSwitch==true, files above $switchAboveSize will switch to "big files" ZipStreamer::setSwitchAboveSize(16777216); // default = 16Mb // For big file, size of the buffer for fread ZipStreamerBigFile::setBufferSize(1048576); //default = 1Mb // first string is localpath on hdd, second is pathname in zip $zipStreamer->add( '/home/wamania/photo.jpg', 'images/photo.jpg'); // you can send directly a ZipStreamerFile object $zipStreamer->add( new ZipStreamerFile( '/home/wamania/movie.mp4', 'movies/movie.mp4')); // Big files are send by stream instead of being charged whole in RAM // Big files are NOT compressed $zipStreamer->addBigFile( '/home/wamania/another-big-movie.mp4', 'movies/another-big-movie.mp4'); // or, directly send a ZipStreamerBigFile object $zipStreamer->add( new ZipStreamerBigFile( '/home/wamania/the-big-movie.mp4', 'movies/the-big-movie.mp4')); return new ZipStreamedResponse($zipStreamer); } }

统计信息

  • 总下载量: 89.42k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 11
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 11
  • Watchers: 1
  • Forks: 5
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固