hanwenbo/fetch
最新稳定版本:1.0.1
Composer 安装命令:
composer require hanwenbo/fetch
包简介
FaShop EasySwoole HttpClient
README 文档
README
该类主要是为了解决第三方包用了guzzle基础请求方法保持一致,又能使用EasySwoole
安装
composer require hanwenbo/fetch
测试
php tests/fetch.php
要在
swoole环境下运行,根目录的docker-compose.yml是写项目经常用到的docker环境 docker-compose up -d docker-compose exec swoole bash composer install php tests/fetch.php
示例代码
GET
$client = new \hanwenbo\fetch\Fetch(); $res = $client->request( 'GET', 'https://www.baidu.com', [ 'header'=>[ 'test'=>1 ], 'query' => [ 'adada' => 121212, ], ] );
POST
form请求
$client = new \hanwenbo\fetch\Fetch(); $res = $client->request( 'POST', 'https://www.baidu.com', [ 'header'=>[ 'test'=>1 ], 'form_params' => [ 'adada' => 121212, ], ] );
json请求
$client = new \hanwenbo\fetch\Fetch(); $res = $client->request( 'POST', 'https://www.baidu.com', [ 'header'=>[ 'test'=>1 ], 'body' => [ 'adada' => 121212, ], ] );
其他的
PUTDELETEPATCH参考POST即可
其他
统计信息
- 总下载量: 73
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Apache-2.0
- 更新时间: 2022-03-08