Download the PHP package colinodell/omnipay-bundle without Composer
On this page you can find all versions of the php package colinodell/omnipay-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download colinodell/omnipay-bundle
More information about colinodell/omnipay-bundle
Files in colinodell/omnipay-bundle
Package omnipay-bundle
Short Description Omnipay bundle for Symfony 2.3+ and 3.0+
License MIT
Homepage https://github.com/colinodell/omnipay-bundle
Informations about the package omnipay-bundle
omnipay-bundle
Simple bundle for implementing Omnipay in your Symfony application.
Versions
omnipay-bundle | Symfony | Omnipay | PHP |
---|---|---|---|
1.x | 2.x or 3.x | 2.x | 5.4+ |
2.x | 2.x or 3.x | 3.x | 5.6+ |
Install
Via Composer
Enable the bundle in your AppKernel.php
:
Usage
This bundle provides a new service called Omnipay
. It contains a single method get()
, which returns a fully-configured gateway for you to use:
You can then use these gateways like usual.
Note: Gateways are "cached" - calling get('Some_Gateway')
multiple times will always return the same object.
Configuration
Gateways can be configured in your app/config/config.yml
file
For example, to configure the Stripe and PayPal Express gateways:
NOTE: You should probably consider using parameters instead of storing credentials directly in your config.yml
like that.
The method names should be whatever you'd typically pass into Omnipay::create()
. The configuration settings vary per gateway - see
Configuring Gateways in the Omnipay documentation for more details.
Registering Custom Gateways
Custom gateways can be registered via the container by tagging them with omnipay.gateway
:
You can then obtain the fully-configured gateway by its alias:
Additional configuration and customization
Default gateway
Add default gateway key to your config:
You can now get default gateway instance:
Disabling gateways
If need to disable a gateway but want to keep all the configuration add disabled_gateways
key to the config:
MyGateway1
gateway will be skipped during gateway registration now.
Customizing Omnipay service
If you need specific gateway selection mechanism or need to get multiple gateways at once consider to extend default Omnipay service. Create your custom Omnipay class, extend it from base class and add custom getters. For example, you might want to get all gateways which implement some interface.
Now you should be able to get vault-aware gateways in your application:
Initialize gateways on registration
By default gateway is initialized only when you call get()
method. If you use custom getters (like
getVaultAwareGateways
from example above) with $this->registeredGateways
inside you might want to initialize them
automatically during registration. Simply add appropriate config key:
Testing
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.