File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change
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.
You can’t perform that action at this time.
0 commit comments