lukaszterg/restc
Composer 安装命令:
composer require lukaszterg/restc
包简介
Simple and fast rest client
README 文档
README
https://github.com/lukaszterg/restc (c) 2024 lukaszjarosinski@gmail.com
Installation
$ php composer.phar require lukaszterg/restc
Basic Usage
$client = new Client(); $headers = array("Content-Type" => "application/x-www-form-urlencoded"); //example headers, unnecessary $parameters = array('name'=>'Name','gender'=>'male','email'=>'email@email.com','status'=>'active'); //example parameters, unnecessary $client->get('http://www.boredapi.com/api/activity'); //url echo "<pre>"; var_dump($client->returnResponse()); echo "</pre>";
Configurable Options
headers - An associative array of HTTP headers and values to be included in every request.
parameters - An associative array of URL or body parameters to be included in every request.
user_agent - User agent string to use in requests.
username - Username to use for HTTP basic authentication. Requires password.
password - Password to use for HTTP basic authentication. Requires username.
Supported methods
The tool supports methods GET, POST, PATCH, DELETE. Examples:
$client->get('http://www.boredapi.com/api/activity'); $client->post('https://gorest.co.in/public/v1/users',array('name'=>'Name','gender'=>'male','email'=>'email@email.com','status'=>'active'),array('Authorization'=>'Bearer '.$token));
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-07-02