Skip to content

Commit d0aa7e0

Browse files
authored
Create UPGRADE.md
1 parent a28a37b commit d0aa7e0

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

UPGRADE.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
## Upgrade Gateways from 2.x to 3.x
2+
3+
The primary difference is the HTTP Client. We are now using HTTPlug (http://httplug.io/) but rely on our own interface.
4+
5+
### Breaking
6+
- Change typehint from Guzzle ClientInterface to `Omnipay\Common\Http\Client`
7+
- `$client->get('..')`/`$client->post('..')` will send the request directly, no longer need to call `->send()`.
8+
- Instead of `$client->createRequest(..)->send()`, you should call `$client->sendRequest($client->createRequest(..))`.
9+
- When sending an AJAX body, convert the body to a string with `json_encode`.
10+
- The response is a PSR-7 Response object. You can call `$response->getBody()->getContents()` to get the body as string.
11+
- `$response->json()` and `$response->xml()` are gone, but `Omnipay\Common\Http\ResponseParser::json($response)`
12+
and `Omnipay\Common\Http\ResponseParser::xml($response)` can be used instead.
13+
- An HTTP Client is no longer added by default by `omnipay/common`, but `omnipay/omnipay` will add Guzzle.
14+
Gateways should not rely on Guzzle or other clients directly.
15+
16+
### Deprecated
17+
- The `$headers` parameters should be an `array` (not `null`, but can be empty)
18+
- `$body` should be a string (eg. `http_build_query($data)` or `json_encode($data)` instead of just $data.

0 commit comments

Comments
 (0)