Skip to content

Releases: thephpleague/omnipay-common

v3.3.0 - Symfony 7 support

08 Mar 11:59
2eca382
Compare
Choose a tag to compare

What's Changed

New Contributors

Full Changelog: v3.2.1...v3.3.0

v3.2.1: require php-http/message-factory directly (#261)

30 May 12:45
80545e9
Compare
Choose a tag to compare
This library still uses the deprecated php-http message factories. They have been deprecated since a while in favor of PSR-17 message factories.

php-http/discovery no longer automatically installs php-http/message-factory.

v3.2.0

12 Feb 13:57
e278ff0
Compare
Choose a tag to compare

Support Symfony 6

Remove guzzle adapter

05 Jun 11:37
5b16387
Compare
Choose a tag to compare
v3.1.2

Update composer.json

Add support for PHP7.2 back

05 Jun 09:53
5f6fc10
Compare
Choose a tag to compare
v3.1.1

Update composer.json

Support PHP8 / Symfony 5

01 Jun 09:08
fae2bc9
Compare
Choose a tag to compare

Officially test and support PHP8. Drop old PHP versions because of PHPUnit 9

v3.0.5: Merge pull request #225 from KenorFR/KenorFR-deprecated-symfony

31 Oct 09:36
0d1f448
Compare
Choose a tag to compare

Fix public visibility in Gateway get/setParameter

02 Jun 05:58
d6a1bed
Compare
Choose a tag to compare

Allow Symfony 5

21 Apr 12:39
24ea70a
Compare
Choose a tag to compare

Support Symfony 5

Omnipay v3 Release

15 May 07:15
Compare
Choose a tag to compare

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

Breaking changes

  • The 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 omnipay/omnipay,
    but otherwise you need to required your own implementation (see PHP HTTP Clients)

Added

  • 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.

Breaking changes

  • Change typehint from Guzzle ClientInterface to Omnipay\Common\Http\ClientInterface
  • $client->get('..')/$client->post('..') etc are removed, you can call $client->request('GET', '').
  • No need to call $request->send(), requests are sent directly.
  • Instead of $client->createRequest(..) you can create+send the request directly with $client->request(..).
  • 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->json() and $response->xml() are gone, but you can implement the logic directly.
  • An HTTP Client is no longer added by default by omnipay/common, but omnipay/omnipay will add Guzzle.
    Gateways should not rely on Guzzle or other clients directly.
  • $body should be a string (eg. http_build_query($data) or json_encode($data) instead of just $data).
  • The $headers parameters should be an array (not null, but can be empty)

Examples:

// 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);

Testing changes

PHPUnit is upgraded to PHPUnit 6. Common issues:

  • setExpectedException() is removed
// 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 @doesNotPerformAssertions