Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Common Laravel Package

omnipay/common

Framework-agnostic core for Omnipay payment gateways. Provides shared interfaces, request/response handling, HTTP client integration, and common utilities used by gateway drivers so apps can add and swap payment providers with a consistent API.

View on GitHub
Deep Wiki
Context7
v3.5.1

What's Changed

New Contributors

Full Changelog: https://github.com/thephpleague/omnipay-common/compare/v3.5.0...v3.5.1

v3.4.0

What's Changed

New Contributors

Full Changelog: https://github.com/thephpleague/omnipay-common/compare/v3.3.0...v3.4.0

v3.3.0

What's Changed

New Contributors

Full Changelog: https://github.com/thephpleague/omnipay-common/compare/v3.2.1...v3.3.0

v3.2.1
v3.2.0

Support Symfony 6

v3.1.2
v3.1.1
v3.1.0

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

v3.0.5
v3.0.4

Fixes #217

v3.0.3

Support Symfony 5

v3.0.0

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](https://github.com/doesNotPerformAssertions)
v3.0-RC2
v3.0-RC1
v3.0-beta.3

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.

v3.0-beta.2

Uses our own Exceptions instead of the PSR package (with unknown timeline)

v3.0-beta.1

Should be a public API freeze hopefully :)

v3.0-alpha.4

Implement PSR-18 Exceptions

v3.0-alpha.3
  • Remove ResponseParser
  • Renamed/removed methods for the Client, just use $client->request('GET', '/path', ...)
  • Added ClientInterface
v3.0-alpha.2
v3.0-alpha.1
2.5.2
v2.5.1
  • Allow Symfony HttpFoundation 3.x
  • Add new MasterCard "2" series BIN range support
  • Improve test coverage
v2.5.0

Incorporating outstanding PRs. This includes changed functionality about the use and detection of card brands.

v2.4.1

Incorporated outstanding PRs, mostly minor/cosmetic/docblock changes.

2.4.0

Adds notification interfaces

v2.3.4

Fix composer issue

v2.3.3

Added better documentation

2.3.2

Update composer to include all third party gateways, as well as those supported by the package directly.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
terminal42/code-quality-tools
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky