jaredchu / jc-request
Another Guzzle wrapper
Installs: 5 780
Dependents: 1
Suggesters: 0
Security: 0
Stars: 5
Watchers: 2
Forks: 2
Open Issues: 0
Requires
- php: >=5.5
- guzzlehttp/guzzle: ^6.2
- jwage/purl: ^0.0.7
Requires (Dev)
- phpunit/phpunit: ^4.0 || ^5.0
This package is not auto-updated.
Last update: 2024-11-10 06:13:48 UTC
README
Another Guzzle wrapper
Installation
$ composer require jaredchu/jc-request
Usage
use JC\HttpClient\JCRequest;
GET
$response = JCRequest::get($url); echo $response->status(); echo $response->body(); var_dump($response->json());
POST
$response = JCRequest::post($url, $params, $headers); echo $response->status(); echo $response->body(); var_dump($response->json());
RESTful
$response = JCRequest::post($url, json_encode($params), $headers); var_dump($response->json());
Basic Auth
$response = JCRequest::get($url, $params, $headers, [ 'auth' => [$userName, $passwd] ]);
Request timeout
$response = JCRequest::get($url, $params, $headers, [ 'connect_timeout' => 2, 'timeout' => 2 ]);
Contributing
- Fork it!
- Create your feature branch:
$ git checkout -b feature/your-new-feature
- Commit your changes:
$ git commit -am 'Add some feature'
- Push to the branch:
$ git push origin feature/your-new-feature
- Submit a pull request.