scratch – Blame information for rev 87
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
87 | office | 1 | Guzzle, PHP HTTP client and webservice framework |
2 | ================================================ |
||
3 | |||
4 | [![Build Status](https://secure.travis-ci.org/guzzle/guzzle.png?branch=master)](http://travis-ci.org/guzzle/guzzle) |
||
5 | |||
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. |
||
8 | |||
9 | ```php |
||
10 | $client = new GuzzleHttp\Client(); |
||
11 | $response = $client->get('http://guzzlephp.org'); |
||
12 | $res = $client->get('https://api.github.com/user', ['auth' => ['user', 'pass']]); |
||
13 | echo $res->getStatusCode(); |
||
14 | // "200" |
||
15 | echo $res->getHeader('content-type'); |
||
16 | // 'application/json; charset=utf8' |
||
17 | echo $res->getBody(); |
||
18 | // {"type":"User"...' |
||
19 | var_export($res->json()); |
||
20 | // Outputs the JSON decoded data |
||
21 | ``` |
||
22 | |||
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, |
||
27 | etc. |
||
28 | - Keep-Alive & connection pooling |
||
29 | - SSL Verification |
||
30 | - Automatic decompression of response bodies |
||
31 | - Streaming multipart file uploads |
||
32 | - Connection timeouts |
||
33 | |||
34 | Get more information and answers with the |
||
35 | [Documentation](http://guzzlephp.org/), |
||
36 | [Forums](https://groups.google.com/forum/?hl=en#!forum/guzzle), |
||
37 | and IRC ([#guzzlephp](irc://irc.freenode.net/#guzzlephp) @ irc.freenode.net). |
||
38 | |||
39 | ### Installing via Composer |
||
40 | |||
41 | The recommended way to install Guzzle is through |
||
42 | [Composer](http://getcomposer.org). |
||
43 | |||
44 | ```bash |
||
45 | # Install Composer |
||
46 | curl -sS https://getcomposer.org/installer | php |
||
47 | ``` |
||
48 | |||
49 | Next, update your project's composer.json file to include Guzzle: |
||
50 | |||
51 | ```javascript |
||
52 | { |
||
53 | "require": { |
||
54 | "guzzlehttp/guzzle": "~4.0" |
||
55 | } |
||
56 | } |
||
57 | ``` |
||
58 | |||
59 | After installing, you need to require Composer's autoloader: |
||
60 | |||
61 | ```php |
||
62 | require 'vendor/autoload.php'; |
||
63 | ``` |
||
64 | |||
65 | ### Documentation |
||
66 | |||
67 | More information can be found in the online documentation at |
||
68 | http://guzzlephp.org/. |