graefe / binary-response
一个用于 Symfony's HttpFoundation 的扩展,允许使用解耦的内存二进制响应。
v0.1.0
2015-06-24 11:45 UTC
Requires
- php: >=5.5.9
- symfony/http-foundation: ^2.7
Requires (Dev)
- phpunit/phpunit: ^4.7
This package is not auto-updated.
Last update: 2024-09-14 17:00:52 UTC
README
BinaryResponse 是一个扩展到 Symfony's HttpFoundation 组件的小型扩展,允许使用解耦的内存二进制响应。BinaryResponse 类的行为几乎与 HttpFoundation 中的 BinaryFileResponse 类相似,它内置了对范围请求的支持。但是,它不是普通文件,而是接受任何实现 VirtualFileSource 合约接口的对象。
InMemorySource 提供了这个合约的基本内存实现
use Graefe\Net\Http\BinaryResponse; use Graefe\Net\Http\BinaryResponse\InMemorySource; $source = new InMemorySource('Any binary data, maybe from a BLOB column.'); $response = new BinaryResponse($source); $reponse->send();