https://github.com/we7coreteam/w7-rangine-zipstream
ZipStream-PHP for Swoole
https://github.com/we7coreteam/w7-rangine-zipstream
rangine swoole zipstream zipstream-php
Last synced: 5 months ago
JSON representation
ZipStream-PHP for Swoole
- Host: GitHub
- URL: https://github.com/we7coreteam/w7-rangine-zipstream
- Owner: we7coreteam
- License: apache-2.0
- Created: 2020-02-20T02:41:26.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-02-20T09:13:51.000Z (over 6 years ago)
- Last Synced: 2024-11-14T17:13:18.489Z (over 1 year ago)
- Topics: rangine, swoole, zipstream, zipstream-php
- Language: PHP
- Size: 9.77 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 说明
基于 [ZipStream-PHP](https://github.com/maennchen/ZipStream-PHP) 库,优化了对 Swoole 扩展的支持。
# 使用
配置 options 与原始库一样,只是需要指定 outputStream 为 Swoole Respons 对象。
\W7\ZipStream\ZipStream 对象继承自 \ZipStream\ZipStream 对象,只是重写了 Send 方法。
使用方法与原始库一致。
```
$options = new \ZipStream\Option\Archive();
$options->setSendHttpHeaders(true);
//指定 output 对象为 swoole response对象
$options->setOutputStream($this->response());
$zip = new \W7\ZipStream\ZipStream('example.zip', $options);
for ($i=0; $i<100000; $i++) {
$zip->addFile($i, 'test');
}
$zip->finish();
```