Guzzle 4.0

Written by unknown - - Aggregated on Saturday November 15, 2014

Guzzle 4.0 has arrived! The new version of Guzzle is now simpler, faster, more flexible, and more powerful than ever.

You can install Guzzle 4 using Composer:

{
    "require": {
        "guzzlehttp/guzzle": "4.*"
    }
}

What’s Guzzle?

Guzzle is a PHP HTTP client that makes it easy to work with HTTP/1.1 and takes the pain out of consuming web services. Here’s a simple example of using Guzzle to interact with the GitHub API:

<?php
$client = new GuzzleHttp\Client();
$res = $client->get('https://api.github.com/user', [
    'auth' =>  ['user', 'pass']
]);
echo $res->getStatusCode();           // 200
echo $res->getHeader('content-type'); // 'application/json; charset=utf8'
echo $res->getBody();                 // {"type":"User"...'
var_export($res->json());             // Outputs the JSON decoded data

What’s Changed?

You can find out more about the changes that were made by reading the blog post about the release candidate: http://mtdowling.com/blog/2014/03/15/guzzle-4-rc/

You can view a list of changes and the upgrade guide to help you migrate from Guzzle 3 to 4 here: https://github.com/guzzle/guzzle/blob/master/UPGRADING.md#3x-to-40

The Guzzle 4.0 repository is available at https://github.com/guzzle/guzzle. Guzzle 3.x development has moved to https://github.com/guzzle/guzzle3. Please post issues for Guzzle 3 on the Guzzle 3 specific repository.

Because Guzzle 4.x was basically a rewrite of the library, I’ve updated Guzzle 4 to use a different namespace and a different Composer package name so that you can use Guzzle 3 and 4 in the same project and slowly migrate pieces of you applications over time as needed.

Plugins and companion libraries

In addition to launching Guzzle 4.0, I’ve also tagged a 1.0 release of the following packages:

The following libraries do not yet have a 1.0 release, but are available for use:

Service Descriptions

Guzzle service descriptions (previously found under the Guzzle\Service namespace) have been moved into their own library at https://github.com/guzzle/guzzle-services. This library is mostly complete but needs some additional testing and documentation.

Documentation

The documentation has been completely rewritten and updated for Guzzle 4.0: http://guzzlephp.org. The Guzzle 3.0 documentation is still available online at http://guzzle3.readthedocs.org.


« A Case for Higher Level PHP Streams in … - unknown

unknown - Favor Hash Lookups Over Array Searches »