项目作者: jaredchu

项目描述 :
Another Guzzle wrapper
高级语言: PHP
项目地址: git://github.com/jaredchu/JCRequest.git
创建时间: 2017-05-31T02:48:18Z
项目社区:https://github.com/jaredchu/JCRequest

开源协议:MIT License

下载


JCRequest

Another Guzzle wrapper

Packagist
Packagist
Travis
Scrutinizer
Codecov
Packagist
FOSSA Status

Installation

$ composer require jaredchu/jc-request

Usage

  1. use JC\HttpClient\JCRequest;

GET

  1. $response = JCRequest::get($url);
  2. echo $response->status();
  3. echo $response->body();
  4. var_dump($response->json());

POST

  1. $response = JCRequest::post($url, $params, $headers);
  2. echo $response->status();
  3. echo $response->body();
  4. var_dump($response->json());

RESTful

  1. $response = JCRequest::post($url, json_encode($params), $headers);
  2. var_dump($response->json());

Basic Auth

  1. $response = JCRequest::get($url, $params, $headers, [
  2. 'auth' => [$userName, $passwd]
  3. ]);

Request timeout

  1. $response = JCRequest::get($url, $params, $headers, [
  2. 'connect_timeout' => 2,
  3. 'timeout' => 2
  4. ]);

Contributing

  1. Fork it!
  2. Create your feature branch: $ git checkout -b feature/your-new-feature
  3. Commit your changes: $ git commit -am 'Add some feature'
  4. Push to the branch: $ git push origin feature/your-new-feature
  5. Submit a pull request.

License

MIT License

FOSSA Status