hanwenbo/fetch 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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,
		],
	] );

其他的 PUT DELETE PATCH 参考 POST 即可

其他

统计信息

  • 总下载量: 73
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Apache-2.0
  • 更新时间: 2022-03-08