matricali / http-client
A wrapper of libcurl that implements PSR-7 HTTP message interface.
1.0.0-alpha3
2018-07-20 13:40 UTC
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: 2024-11-11 15:11:26 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.