定制 paramoredigital/rest-request 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-01-02