1
1
Guzzle, PHP HTTP client and webservice framework
2
2
================================================
4
[![Build Status](https://secure.travis-ci.org/guzzle/guzzle.svg?branch=master)](http://travis-ci.org/guzzle/guzzle)
6
Guzzle is a PHP HTTP client that makes it easy to send HTTP requests and
7
trivial to integrate with web services.
9
- Manages things like persistent connections, represents query strings as
10
collections, simplifies sending streaming POST requests with fields and
11
files, and abstracts away the underlying HTTP transport layer.
12
- Can send both synchronous and asynchronous requests using the same interface
13
without requiring a dependency on a specific event loop.
14
- Pluggable HTTP adapters allows Guzzle to integrate with any method you choose
15
for sending HTTP requests over the wire (e.g., cURL, sockets, PHP's stream
16
wrapper, non-blocking event loops like ReactPHP.
17
- Guzzle makes it so that you no longer need to fool around with cURL options,
18
stream contexts, or sockets.
4
[![Build Status](https://secure.travis-ci.org/guzzle/guzzle.png?branch=master)](http://travis-ci.org/guzzle/guzzle)
6
Guzzle is a PHP HTTP client that makes it easy to work with HTTP/1.1 and takes
7
the pain out of consuming web services.
21
10
$client = new GuzzleHttp\Client();
29
18
// {"type":"User"...'
30
19
var_export($res->json());
31
20
// Outputs the JSON decoded data
33
// Send an asynchronous request.
34
$req = $client->createRequest('GET', 'http://httpbin.org', ['future' => true]);
35
$client->send($req)->then(function ($response) {
36
echo 'I completed! ' . $response;
23
- Pluggable HTTP adapters that can send requests serially or in parallel
24
- Doesn't require cURL, but uses cURL by default
25
- Streams data for both uploads and downloads
26
- Provides event hooks & plugins for cookies, caching, logging, OAuth, mocks,
28
- Keep-Alive & connection pooling
30
- Automatic decompression of response bodies
31
- Streaming multipart file uploads
40
34
Get more information and answers with the
41
35
[Documentation](http://guzzlephp.org/),
42
36
[Forums](https://groups.google.com/forum/?hl=en#!forum/guzzle),
43
and [Gitter](https://gitter.im/guzzle/guzzle).
37
and IRC ([#guzzlephp](irc://irc.freenode.net/#guzzlephp) @ irc.freenode.net).
45
39
### Installing via Composer
52
46
curl -sS https://getcomposer.org/installer | php
55
Next, run the Composer command to install the latest stable version of Guzzle:
49
Next, update your project's composer.json file to include Guzzle:
58
composer.phar require guzzlehttp/guzzle
54
"guzzlehttp/guzzle": "~4.0"
61
59
After installing, you need to require Composer's autoloader: