scratch – Blame information for rev 87
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
87 | office | 1 | .. title:: Guzzle | PHP HTTP client and framework for consuming RESTful web services |
2 | |||
3 | ====== |
||
4 | Guzzle |
||
5 | ====== |
||
6 | |||
7 | Guzzle is a PHP HTTP client that makes it easy to work with HTTP/1.1 and takes |
||
8 | the pain out of consuming web services. |
||
9 | |||
10 | - Pluggable HTTP adapters that can send requests serially or in parallel |
||
11 | - Doesn't require cURL, but uses cURL by default |
||
12 | - Streams data for both uploads and downloads |
||
13 | - Provides event hooks & plugins for cookies, caching, logging, OAuth, mocks, etc. |
||
14 | - Keep-Alive & connection pooling |
||
15 | - SSL Verification |
||
16 | - Automatic decompression of response bodies |
||
17 | - Streaming multipart file uploads |
||
18 | - Connection timeouts |
||
19 | |||
20 | .. code-block:: php |
||
21 | |||
22 | $client = new GuzzleHttp\Client(); |
||
23 | $res = $client->get('https://api.github.com/user', [ |
||
24 | 'auth' => ['user', 'pass'] |
||
25 | ]); |
||
26 | echo $res->getStatusCode(); // 200 |
||
27 | echo $res->getHeader('content-type'); // 'application/json; charset=utf8' |
||
28 | echo $res->getBody(); // {"type":"User"...' |
||
29 | var_export($res->json()); // Outputs the JSON decoded data |
||
30 | |||
31 | User guide |
||
32 | ---------- |
||
33 | |||
34 | .. toctree:: |
||
35 | :maxdepth: 2 |
||
36 | |||
37 | overview |
||
38 | quickstart |
||
39 | clients |
||
40 | http-messages |
||
41 | events |
||
42 | streams |
||
43 | adapters |
||
44 | testing |
||
45 | faq |
||
46 | |||
47 | HTTP Components |
||
48 | --------------- |
||
49 | |||
50 | There are a number of optional libraries you can use along with Guzzle's HTTP |
||
51 | layer to add capabilities to the client. |
||
52 | |||
53 | `Log Subscriber <https://github.com/guzzle/log-subscriber>`_ |
||
54 | Logs HTTP requests and responses sent over the wire using customizable |
||
55 | log message templates. |
||
56 | |||
57 | `OAuth Subscriber <https://github.com/guzzle/oauth-subscriber>`_ |
||
58 | Signs requests using OAuth 1.0. |
||
59 | |||
60 | `Progress Subscriber <https://github.com/guzzle/progress-subscriber>`_ |
||
61 | Emits progress events when uploading and downloading data. |
||
62 | |||
63 | `Cache Subscriber <https://github.com/guzzle/cache-subscriber>`_ |
||
64 | Implements a private transparent proxy cache that caches HTTP responses. |
||
65 | |||
66 | `Retry Subscriber <https://github.com/guzzle/retry-subscriber>`_ |
||
67 | Retries failed requests using customizable retry strategies (e.g., retry |
||
68 | based on response status code, cURL error codes, etc.) |
||
69 | |||
70 | `Message Integrity Subscriber <https://github.com/guzzle/message-integrity-subscriber>`_ |
||
71 | Verifies the message integrity of HTTP responses using customizable |
||
72 | validators. This plugin can be used, for example, to verify the Content-MD5 |
||
73 | headers of responses. |
||
74 | |||
75 | Service Description Commands |
||
76 | ---------------------------- |
||
77 | |||
78 | You can use the **Guzzle Command** library to encapsulate interaction with a |
||
79 | web service using command objects. Building on top of Guzzle's command |
||
80 | abstraction allows you to easily implement things like service description that |
||
81 | can be used to serialize requests and parse responses using a meta-description |
||
82 | of a web service. |
||
83 | |||
84 | `Guzzle Command <https://github.com/guzzle/command>`_ |
||
85 | Provides the foundational elements used to build high-level, command based, |
||
86 | web service clients with Guzzle. |
||
87 | |||
88 | `Guzzle Services <https://github.com/guzzle/guzzle-services>`_ |
||
89 | Provides an implementation of the *Guzzle Command* library that uses |
||
90 | Guzzle service descriptions to describe web services, serialize requests, |
||
91 | and parse responses into easy to use model structures. |