7
## Rewritten Adapter Layer
9
Guzzle now uses [RingPHP](http://ringphp.readthedocs.org/en/latest) to send
10
HTTP requests. The `adapter` option in a `GuzzleHttp\Client` constructor
11
is still supported, but it has now been renamed to `handler`. Instead of
12
passing a `GuzzleHttp\Adapter\AdapterInterface`, you must now pass a PHP
13
`callable` that follows the RingPHP specification.
15
## Removed Fluent Interfaces
17
[Fluent interfaces were removed](http://ocramius.github.io/blog/fluent-interfaces-are-evil)
18
from the following classes:
20
- `GuzzleHttp\Collection`
23
- `GuzzleHttp\Post\PostBody`
24
- `GuzzleHttp\Cookie\SetCookie`
26
## Removed functions.php
28
Removed "functions.php", so that Guzzle is truly PSR-4 compliant. The following
29
functions can be used as replacements.
31
- `GuzzleHttp\json_decode` -> `GuzzleHttp\Utils::jsonDecode`
32
- `GuzzleHttp\get_path` -> `GuzzleHttp\Utils::getPath`
33
- `GuzzleHttp\Utils::setPath` -> `GuzzleHttp\set_path`
34
- `GuzzleHttp\Pool::batch` -> `GuzzleHttp\batch`. This function is, however,
35
deprecated in favor of using `GuzzleHttp\Pool::batch()`.
37
The "procedural" global client has been removed with no replacement (e.g.,
38
`GuzzleHttp\get()`, `GuzzleHttp\post()`, etc.). Use a `GuzzleHttp\Client`
39
object as a replacement.
41
## `throwImmediately` has been removed
43
The concept of "throwImmediately" has been removed from exceptions and error
44
events. This control mechanism was used to stop a transfer of concurrent
45
requests from completing. This can now be handled by throwing the exception or
46
by cancelling a pool of requests or each outstanding future request
49
## headers event has been removed
51
Removed the "headers" event. This event was only useful for changing the
52
body a response once the headers of the response were known. You can implement
53
a similar behavior in a number of ways. One example might be to use a
54
FnStream that has access to the transaction being sent. For example, when the
55
first byte is written, you could check if the response headers match your
56
expectations, and if so, change the actual stream body that is being
59
## Updates to HTTP Messages
61
Removed the `asArray` parameter from
62
`GuzzleHttp\Message\MessageInterface::getHeader`. If you want to get a header
63
value as an array, then use the newly added `getHeaderAsArray()` method of
64
`MessageInterface`. This change makes the Guzzle interfaces compatible with
348
285
methods and a way in which to modify the transaction at that specific point in
349
286
time (e.g., intercept the request and set a response on the transaction).
351
- `request.before_send` has been renamed to `before` and now emits a
288
- `request.before_send` has been renamed to ``before`` and now emits a
352
289
`GuzzleHttp\Event\BeforeEvent`
353
290
- `request.complete` has been renamed to `complete` and now emits a
354
291
`GuzzleHttp\Event\CompleteEvent`.