paramoredigital/rest-request
最新稳定版本:v1.3
Composer 安装命令:
composer require paramoredigital/rest-request
包简介
A simple PHP class for submitting REST requests via cURL.
README 文档
README
A PHP class for submitting REST requests via cURL.
Configuration
Open the RestRequestConfig.php class and set the $baseUrl parameter to be the base URL of the API. Here, you can also set a default format for the request body (JSON or Form-encoded).
Usage
Define a new client like this:
$request = new \ParamoreDigital\RestRequest();
You can set cURL options like this:
$request->setHttpOptions(array(CURLOPT_HTTPAUTH => CURLAUTH_BASIC, CURLOPT_USERPWD => 'username:password'));
You can set parameters like this:
$request->setParams(array('firstName' => 'Ben', 'lastName' => 'Wilkins'));
You can manually set an endpoint:
$request->setEndPoint('/some/endpoint');
$request->post();
Or, you can pass the endpoint straight into the action method:
$request->post('/some/endpoint');
统计信息
- 总下载量: 23
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-01-02