w7 / rangine-http-message
rangine http message
Installs: 10 222
Dependents: 3
Suggesters: 0
Security: 0
Stars: 0
Watchers: 3
Forks: 0
Open Issues: 0
Requires
Requires (Dev)
- swoole/ide-helper: ^4.4
- w7/php-cs-fixer: *
- dev-master
- v3.0.1
- v3.0.0
- v2.5.3
- v2.5.2
- v2.5.1
- v2.5.0
- v2.2.8
- v2.2.7
- v2.2.6
- v2.2.5
- v2.2.4
- v2.2.3
- v2.2.2
- v2.2.1
- v2.2.0
- v2.1.8
- v2.1.7
- v2.1.6
- v2.1.5
- v2.1.4
- v2.1.3
- v2.1.2
- v2.1.1
- v2.1.0
- v2.0.13
- v2.0.12
- v2.0.11
- v2.0.10
- v2.0.9
- v2.0.8
- v2.0.7
- v2.0.6
- v2.0.5
- v2.0.4
- v2.0.3
- v2.0.2
- v2.0.1
- v2.0.0
- v1.0.6
- v1.0.5
- v1.0.4
- v1.0.3
- v1.0.2
- v1.0.1
- v1.0.0
- dev-php8.1
- dev-fix-2.2.5
- dev-del-clone
This package is auto-updated.
Last update: 2024-12-24 13:44:57 UTC
README
swoole request / response 的 psr 标准的实现,fork 自 Swoft Http-message 组件,感谢 Swoft 团队。
支持下载文件及发送文件Chunk。兼容Fpm模式和Swoole Server模式,根据不同的来源来构造 Request 和 Response
use
初始化 Swoole Request Response对象
$server = new \Swoole\Http\Server('0.0.0.0', 88, SWOOLE_PROCESS, SWOOLE_SOCK_TCP); $server->on('request', function ($request, $response) { $psr7Request = \W7\Http\Message\Server\Request::loadFromSwooleRequest($request); $psr7Response = new \W7\Http\Message\Server\Response(); $psr7Response->setOutputer(new \W7\Http\Message\Outputer\SwooleResponseOutputer($response)); //获取 Post $code = $psr7Request->post('code'); // 发送一个文件 // $filePath 下载的文件物理路径 // $startPos 需要分片下载时,指定文件的开始位置 // $chunkFileSize 需要分片下载时,每个分片的大小 $psr7Response->withFile(new File($filePath, $startPos, $chunkFileSize)); }); $server->start();
初始化 Fpm Request Response对象
$psr7Request = \W7\Http\Message\Server\Request::loadFromFpmRequest(); $psr7Response = new \W7\Http\Message\Server\Response(); $psr7Response->setOutputer(new \W7\Http\Message\Outputer\FpmResponseOutputer());
其它使用方法参考软擎开发文档