Download the PHP package yiqiniu/easyhttp without Composer
On this page you can find all versions of the php package yiqiniu/easyhttp. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Please rate this library. Is it a good library?
Informations about the package easyhttp
EasyHttp 是一个轻量级、语义化、对IDE友好的HTTP客户端,支持常见的HTTP请求、异步请求和并发请求,让你可以快速地使用 HTTP 请求与其他 Web 应用进行通信。
EasyHttp并不强制依赖于cURL,如果没有安装cURL,EasyHttp会自动选择使用PHP流处理,或者你也可以提供自己的发送HTTP请求的处理方式。
如果您觉得EasyHttp对您有用的话,别忘了给点个赞哦^_^ !
github:github.com/gouguoyin/easyhttp
gitee:gitee.com/gouguoyin/easyhttp
安装说明
环境依赖
- PHP >= 5.5.0
- 如果使用PHP流处理,allow_url_fopen 必须在php.ini中启用。
- 如果使用cURL处理,cURL >= 7.19.4,并且编译了OpenSSL 与 zlib。
一键安装
composer require gouguoyin/easyhttp
发起请求
同步请求
常规请求
发送 Content-Type 编码请求
发送 Multipart 表单请求
表单enctype属性需要设置成 multipart/form-data
携带请求头的请求
携带重定向的请求
携带认证的请求
携带 User-Agent 的请求
携带Token令牌的请求
携带认证文件的请求
携带SSL证书的请求
携带COOKIE的请求
携带协议版本的请求
携带代理的请求
设置超时时间(单位秒)
设置延迟时间(单位秒)
设置并发次数
异步请求
异步并发请求
如果未调用concurrency()方法,并发次数默认为$promises的元素个数,$promises数组里必须是异步请求
使用响应
发起请求后会返回一个 Gouguoyin\EasyHttp\Response $response的实例,该实例提供了以下方法来检查请求的响应:
异常处理
请求在发生客户端或服务端错误时会抛出 Gouguoyin\EasyHttp\RequestException $e异常,该实例提供了以下方法来返回异常信息:
更新日志
2022-05-11
- 新增removeBodyFormat() 用于withOptions 指定body时,清除原由的bodyFromat
-
2022-05-10
- 新增发送原生请求的方法client()
- 新增发送原生异步请求的方法clientASync()
-
2021-01-23
- 修复上传的asMultipart错误的bug
- 新增 wait() 用于等待异步请求的加调
2020-03-30
- 修复部分情况下IDE不能智能提示的BUG
- get()、getAsync()方法支持带参数的url
- 新增withUA()方法
- 新增withStream()方法
- 新增asMultipart()方法,attach()的别名
- 新增multiAsync()异步并发请求方法
2020-03-20
- 新增异步请求getAsync()方法
- 新增异步请求postAsync()方法
- 新增异步请求patchAsync()方法
- 新增异步请求putAsync()方法
- 新增异步请求deleteAsync()方法
- 新增异步请求headAsync()方法
- 新增异步请求optionsAsync()方法
Todo List
- [x] 异步请求
- [x] 并发请求
- [ ] 重试机制
- [ ] 支持http2
- [ ] 支持swoole
All versions of easyhttp with dependencies
PHP Build Version
Package Version
The package yiqiniu/easyhttp contains the following files
Loading the files please wait ....