|
| 1 | +# Upgrading to PHP HTTP Adapter from Ivory Http Adapter |
| 2 | + |
| 3 | +There are some major changes between the two library. This guide will help you upgrading your code. |
| 4 | + |
| 5 | + |
| 6 | +## New vendor |
| 7 | + |
| 8 | +The new organization name is **PHP HTTP**. This suggests that while our main product is the HTTP Adapter project, we are not limited to it. We plan to collect any kind of HTTP related packages written in PHP. |
| 9 | + |
| 10 | +Our composer vendor name is `php-http`, our vendor namespace is `Http`. |
| 11 | + |
| 12 | + |
| 13 | +## Package separation |
| 14 | + |
| 15 | +One of the biggest changes changes is the package separation. One big package is separated ito several smaller one. |
| 16 | + |
| 17 | +These packages are: |
| 18 | + |
| 19 | +### adapter |
| 20 | + |
| 21 | +**Interfaces for HTTP Adapters** |
| 22 | + |
| 23 | +Namespace: `Http\Adapter` |
| 24 | +Repository: https://github.com/php-http/adapter |
| 25 | + |
| 26 | + |
| 27 | +### *-adapter |
| 28 | + |
| 29 | +**Each adapter is separated into its own package. This allows to make requirements to the underlying HTTP Client libraries.** |
| 30 | + |
| 31 | +Namespace: `Http\Adapter` |
| 32 | +Repository: https://github.com/php-http/*-adapter |
| 33 | + |
| 34 | + |
| 35 | +### client |
| 36 | + |
| 37 | +**Interfaces for HTTP Clients** |
| 38 | + |
| 39 | +Namespace: `Http\Client` |
| 40 | +Repository: https://github.com/php-http/client |
| 41 | + |
| 42 | + |
| 43 | +### helper |
| 44 | + |
| 45 | +**Helper classes for HTTP content** |
| 46 | + |
| 47 | +Namespace: `Http\Helper` |
| 48 | +Repository: https://github.com/php-http/helper |
| 49 | + |
| 50 | + |
| 51 | +### discovery |
| 52 | + |
| 53 | +**Discovery service to find installed resources (like adapters)** |
| 54 | + |
| 55 | +Namespace: `Http\Discovery` |
| 56 | +Repository: https://github.com/php-http/discovery |
| 57 | +Documentation: http://php-http.readthedocs.org/en/latest/discovery/ |
| 58 | + |
| 59 | + |
| 60 | +## Removed HTTP methods from adapter |
| 61 | + |
| 62 | +In the Ivory package there are two interfaces: |
| 63 | + |
| 64 | +- Ivory\HttpAdapter\PsrHttpAdapter |
| 65 | +- Ivory\HttpAdapter\HttpAdapter |
| 66 | + |
| 67 | +These has been transformed into: |
| 68 | + |
| 69 | +- Http\Adapter\HttpAdapter |
| 70 | +- Http\Client\HttpClient |
| 71 | + |
| 72 | +Every adapter in the Ivory package implemented both interfaces. In the new packages only the PSR-7 request acceptor methods are implelented (which can be found in `Http\Adapter\HttpAdapter`). |
| 73 | + |
| 74 | +To preserve some functionality, we created a special adapter called `adapter-client`. This adapter implements both interfaces and accepts an instance of `Http\Adapter\HttpAdapter`. |
0 commit comments