razonyang/swoole-unit
最新稳定版本:1.0.0
Composer 安装命令:
composer require razonyang/swoole-unit
包简介
PSR-7 implementation for Swoole
README 文档
README
Installation
composer require razonyang/swoole-unit --prefer-dist --dev
Helpers
Request Builder
The RequestBuilder generates Swoole\Http\Request instances.
<?php $request = RequestBuilder::get('/') ->protocol('HTTP/1.1') ->host('localhost') ->contentType('application/x-www-form-urlencoded') ->contentLength(8) ->headers([ 'X-Foo' => [ 'Bar', ], ]) ->body('hello=world') ->create();
The RequestBuilder supports chaining calls until create.
Form Data
$data = [ 'hello' => 'world', ]; $request = RequestBuilder::post('/users') ->formData($data) ->create()
Multipart Form Data
$data = [ 'hello' => 'world', ]; $files = [ 'avatar' => __DIR__ . DIRECTORY_SEPARATOR . 'avatar.jpg', ]; $request = RequestBuilder::post('/users') ->multipart($data, $files) ->create()
JSON Data
$data = [ 'hello' => 'world', ]; $request = RequestBuilder::post('/users') ->jsonData($data) ->create()
统计信息
- 总下载量: 100
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 2
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-09-18