This package provide a simple and lighter wrapper around Guzzle HTTP client
You can install the package via composer:
composer require mawuekom/http-request-wrapper
// Simple usage
use Mawuekom\HttpRequestWrapper\HttpRequest;
$request = new HttpRequest('http://httpbin.org');
$response = $request ->send('GET', 'get');
echo $response ->getBody();
// Simple usage
use Mawuekom\HttpRequestWrapper\HttpRequest;
$request = new HttpRequest('http://httpbin.org');
$response = $request ->get('get');
// You can also override default base URI
$response = $request ->get('http://httpbin.org/get');
$request ->post('http://httpbin.org/post');
$request ->put('http://httpbin.org/put');
$request ->patch('http://httpbin.org/patch');
$request ->delete('http://httpbin.org/delete');
You can also use helper
use Mawuekom\HttpRequestWrapper\Helpers\HttpRequestHelper;
class Test
{
use HttpRequestHelper;
private $baseUri = 'http://httpbin.org/';
public function data()
{
$res = $this ->makeRequest('GET', 'get');
return $res ->getBody();
}
public function getData()
{
$res = $this ->get('get');
return $res ->getBody();
}
}
composer test
Please see CHANGELOG for more information what has changed recently.
Please see CONTRIBUTING for details.
The MIT License (MIT). Please see License File for more information.