drnkwati/guzzle6

PHP 5.3-compatible fork of Guzzle 6

dev-master / 6.0.x-dev 2018-03-13 15:17 UTC

This package is auto-updated.

Last update: 2024-10-22 11:21:26 UTC


README

Build Status Latest Stable Version License

A PHP 5.3-compatible fork of Guzzle 6.

Why?

Sadly, 60% of all PHP web servers still run PHP 5.4 and lower, but Guzzle needs PHP 5.5 or higher. This fork makes Guzzle 6 compatible with PHP 5.3.29 through 7.1.

How to Use This Fork

Usage is identical to guzzle/guzzle

Guzzle is a PHP HTTP client that makes it easy to send HTTP requests and trivial to integrate with web services.

  • Simple interface for building query strings, POST requests, streaming large uploads, streaming large downloads, using HTTP cookies, uploading JSON data, etc...
  • Can send both synchronous and asynchronous requests using the same interface.
  • Uses PSR-7 interfaces for requests, responses, and streams. This allows you to utilize other PSR-7 compatible libraries with Guzzle.
  • Abstracts away the underlying HTTP transport, allowing you to write environment and transport agnostic code; i.e., no hard dependency on cURL, PHP streams, sockets, or non-blocking event loops.
  • Middleware system allows you to augment and compose client behavior.
$client = new \Hough\Guzzle\Client();
$res = $client->request('GET', 'https://api.github.com/repos/guzzle/guzzle');
echo $res->getStatusCode();
// 200
echo $res->getHeaderLine('content-type');
// 'application/json; charset=utf8'
echo $res->getBody();
// '{"id": 1420053, "name": "guzzle", ...}'

// Send an asynchronous request.
$request = new \Hough\Psr7\Request('GET', 'http://httpbin.org');
$promise = $client->sendAsync($request)->then(function ($response) {
    echo 'I completed! ' . $response->getBody();
});
$promise->wait();

Help and docs