PHPackages                             colinodell/omnipay-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Payment Processing](/categories/payments)
4. /
5. colinodell/omnipay-bundle

AbandonedArchivedLibrary[Payment Processing](/categories/payments)

colinodell/omnipay-bundle
=========================

Omnipay bundle for Symfony 2.3+ and 3.0+

v2.0.0(7y ago)755.0k12[1 issues](https://github.com/colinodell/omnipay-bundle/issues)[1 PRs](https://github.com/colinodell/omnipay-bundle/pulls)MITPHPPHP &gt;=5.6

Since Mar 20Pushed 7y ago1 watchersCompare

[ Source](https://github.com/colinodell/omnipay-bundle)[ Packagist](https://packagist.org/packages/colinodell/omnipay-bundle)[ Docs](https://github.com/colinodell/omnipay-bundle)[ RSS](/packages/colinodell-omnipay-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (6)Dependencies (5)Versions (8)Used By (0)

omnipay-bundle
==============

[](#omnipay-bundle)

[![Latest Version](https://camo.githubusercontent.com/799b0c02ec8b4ea127734ef9243b288535385d5fbc6d0178198abbb283f1d0db/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f636f6c696e6f64656c6c2f6f6d6e697061792d62756e646c652e7376673f7374796c653d666c61742d737175617265)](https://github.com/colinodell/omnipay-bundle/releases)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/0f3e14ab461456b59d689489b9244a74cdf320a5bc67501160fb9fe376d870d2/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f636f6c696e6f64656c6c2f6f6d6e697061792d62756e646c652f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/colinodell/omnipay-bundle)[![Coverage Status](https://camo.githubusercontent.com/aeff2153e2fa016e5bdecbf245bd7946d49379ef7d82c0d78c86761ca28679a3/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f636f6c696e6f64656c6c2f6f6d6e697061792d62756e646c652e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/colinodell/omnipay-bundle/code-structure)[![Quality Score](https://camo.githubusercontent.com/4bf5140aa7cc698430db16dd69c202ee864b431b050418369b739c18f19e6d51/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f636f6c696e6f64656c6c2f6f6d6e697061792d62756e646c652e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/colinodell/omnipay-bundle)[![Total Downloads](https://camo.githubusercontent.com/ec1f7d6a8140d4382b1ca1b6cf5d3047a74473690842d387d400da883faa3a5c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f636f6c696e6f64656c6c2f6f6d6e697061792d62756e646c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/colinodell/omnipay-bundle)

Simple bundle for implementing [Omnipay](http://omnipay.thephpleague.com/) in your Symfony application.

Versions
--------

[](#versions)

omnipay-bundleSymfonyOmnipayPHP**1.x**2.x or 3.x**2.x**5.4+**2.x**2.x or 3.x**3.x**5.6+Install
-------

[](#install)

Via Composer

```
$ composer require colinodell/omnipay-bundle
```

Enable the bundle in your `AppKernel.php`:

```
new ColinODell\OmnipayBundle\OmnipayBundle(),
```

Usage
-----

[](#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:

```
$stripe = $this->get('omnipay')->get('Stripe');

$paypal = $this->get('omnipay')->get('PayPal_Express');
```

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

[](#configuration)

Gateways can be configured in your `app/config/config.yml` file

```
omnipay:
    methods:
        # Your config goes here
```

For example, to configure the [Stripe](https://github.com/thephpleague/omnipay-stripe) and [PayPal Express](https://github.com/thephpleague/omnipay-paypal) gateways:

```
omnipay:
    methods:
        Stripe:
            apiKey: sk_test_BQokikJOvBiI2HlWgH4olfQ2

        PayPal_Express:
            username:     test-facilitator_api1.example.com
            password:     3MPI3VB4NVQ3XSVF
            signature:    6fB0XmM3ODhbVdfev2hUXL2x7QWxXlb1dERTKhtWaABmpiCK1wtfcWd.
            testMode:     false
            solutionType: Sole
            landingPage:  Login
```

**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](http://omnipay.thephpleague.com/gateways/configuring/) in the Omnipay documentation for more details.

Registering Custom Gateways
---------------------------

[](#registering-custom-gateways)

Custom gateways can be registered via the container by tagging them with `omnipay.gateway`:

```
# services.yml
services:
    my.test.gateway:
        class: Path\To\MyTestGateway
        tags:
            - { name: omnipay.gateway, alias: MyTest }

# config.yml
omnipay:
    methods:
        # Reference the gateway alias here
        MyTest:
            apiKey: abcd1234!@#
```

You can then obtain the fully-configured gateway by its alias:

```
$this->get('omnipay')->get('MyTest');
```

Additional configuration and customization
------------------------------------------

[](#additional-configuration-and-customization)

### Default gateway

[](#default-gateway)

Add default gateway key to your config:

```
# config.yml
omnipay:
    methods:
        MyGateway1:
            apiKey: abcd1234!@#
        MyGateway2:
            apiKey: abcd45678!@#

    default_gateway: MyGateway1
```

You can now get default gateway instance:

```
$omnipay->getDefaultGateway();
```

### Disabling gateways

[](#disabling-gateways)

If need to disable a gateway but want to keep all the configuration add `disabled_gateways` key to the config:

```
# config.yml
omnipay:
    methods:
        MyGateway1:
            apiKey: abcd1234!@#
        MyGateway2:
            apiKey: abcd45678!@#

    disabled_gateways: [ MyGateway1 ]
```

`MyGateway1` gateway will be skipped during gateway registration now.

### Customizing Omnipay service

[](#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.

```
