giggsey/psr7-stream-response
最新稳定版本:1.1.0
Composer 安装命令:
composer require giggsey/psr7-stream-response
包简介
Build a File Response from a PSR-7 Stream
README 文档
README
Why?
Symfony's BinaryFileResponse allows presenting files to download to HTTP Clients. However, this expects full file paths. Some projects may want to stream a PSR-7 Stream to the client instead.
How to use
Instead of returning a BinaryFileResponse, create a PSR7StreamResponse, and return that.
Before
$response = new BinaryFileResponse($filePath); $response = $response->setContentDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT, 'my-file.mp3'); return $response;
After
$response = new PSR7StreamResponse($stream, 'audio/mpeg'); $response = $response->setContentDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT, 'my-file.mp3'); return $response;
统计信息
- 总下载量: 51.9k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 5
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-08-08