Be notified of new releases
Create your free GitHub account today to subscribe to this repository for new releases and build software alongside 28 million developers.Sign up
v3.0.0 - 2018-05-14
Omnipay 3.0 focuses on separation of the HTTP Client, to be independent of Guzzle.
This release brings compatibility with the latest Symfony 3+4 and Laravel 5.
The breaking changes for applications using Omnipay are kept to a minimum.
Upgrading applications from Omnipay 2.x to 3.x
redirect()method no calls
exit()after sending the content. This is up to the developer now.
- An HTTP Client is required. Guzzle will be installed when using
but otherwise you need to required your own implementation (see PHP HTTP Clients)
- It is now possible to use
setAmountInteger(integer $value)to set the amount in the base units of the currency.
- Support for Money for PHP objects are added, by using
setMoney(Money $money)the Amount and Currency are set.
Upgrading Gateways from 2.x to 3.x
The primary difference is the HTTP Client. We are now using HTTPlug (http://httplug.io/) but rely on our own interface.
- Change typehint from Guzzle ClientInterface to
$client->post('..')etc are removed, you can call
- No need to call
$request->send(), requests are sent directly.
- Instead of
$client->createRequest(..)you can create+send the request directly with
- When sending a JSON body, convert the body to a string with
json_encode()and set the correct Content-Type.
- The response is a PSR-7 Response object. You can call
$response->getBody()->getContents()to get the body as string.
$response->xml()are gone, but you can implement the logic directly.
- An HTTP Client is no longer added by default by
omnipay/omnipaywill add Guzzle.
Gateways should not rely on Guzzle or other clients directly.
$bodyshould be a string (eg.
json_encode($data)instead of just
$headersparameters should be an
null, but can be empty)
// V2 XML: $response = $this->httpClient->post($this->endpoint, null, $data)->send(); $result = $httpResponse->xml(); // V3 XML: $response = $this->httpClient->request('POST', $this->endpoint, , http_build_query($data)); $result = simplexml_load_string($httpResponse->getBody()->getContents());
// Example JSON request: $response = $this->httpClient->request('POST', $this->endpoint, [ 'Accept' => 'application/json', 'Content-Type' => 'application/json', ], json_encode($data)); $result = json_decode($response->getBody()->getContents(), true);
PHPUnit is upgraded to PHPUnit 6. Common issues:
// PHPUnit 5: $this->setExpectedException($class, $message); // PHPUnit 6: $this->expectException($class); $this->expectExceptionMessage($message);
- Tests that do not perform any assertions, will be marked as risky. This can be avoided by annotating them with
Adds setAmountInteger instead of the Money object. getMoney() is used to private, gateways should use the getAmount or getAmountInteger instead. This is a BC break between the v3-betas, but same as v2.
- Remove ResponseParser
- Renamed/removed methods for the Client, just use
$client->request('GET', '/path', ...)
- Added ClientInterface