jorge-matricali / http-client
A wrapper of libcurl that implements PSR-7 HTTP message interface.
Installs: 68 420
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 1
Forks: 3
Open Issues: 4
Requires
- php: >=5.4.0
- psr/http-message: ^1.0
Requires (Dev)
- phpunit/phpunit: ~4.0
- satooshi/php-coveralls: ~1.0
- squizlabs/php_codesniffer: ~1.5
This package is auto-updated.
Last update: 2019-12-10 23:25:28 UTC
README
PSR-7 HTTP Client (cURL)
Note that this is not an HTTP protocol implementation of its own. It is merely a wrapper of libcurl that implements PSR-7 HTTP message interface.
Requirements
- PHP 5.4 or newer
- cURL extension
Installation
composer require matricali/http-client
Usage
Sending GET request
use Matricali\Http\Client;
$client = new Client();
$response = $client->get('http://www.example.com/');
echo $response->getBody();
Sending POST request
use Matricali\Http\Client;
$client = new Client();
$payload = '{"name": "John Doe"}';
$response = $client->post('http://www.example.com/', $payload);
echo $response->getBody();
Contributing
Contributions, issues, pull requests are welcome. See CONTRIBUTING.md
License
php-http-client is MIT licensed.