@@ -41,7 +41,7 @@ You can then use these gateways like usual.
4141
4242## Configuration
4343
44- Create config file ` ./config/packages/omnipay.yaml ` or copy-paste from [ example] ( config.example.yaml ) .<br >
44+ Create config file ` ./config/packages/omnipay.php ` or copy-paste from [ example] ( config.example.php ) .<br >
4545Gateways can be configured in this file, i.e.:
4646
4747``` yml
@@ -76,20 +76,23 @@ The configuration settings vary per gateway - see
7676
7777Custom gateways can be registered via the container by tagging them with `omnipay.gateway` :
7878
79- ` ` ` yml
80- # services.yaml
81- services:
82- my.custom.gateway:
83- class: Path\T o\C ustomGateway
84- tags:
85- - { name: omnipay.gateway, alias: CustomGateway }
86-
87- # omnipay.yaml
88- omnipay:
89- methods:
90- # Reference the gateway alias here
91- CustomGateway:
92- apiKey: pa$$w0rd
79+ ` ` ` php
80+ # services.php
81+ $services = $containerConfigurator->services();
82+
83+ $services->set('my.custom.gateway', 'Path\T o\C ustomGateway')
84+ ->tag('omnipay.gateway', [
85+ 'alias' => 'CustomGateway',
86+ ]);
87+
88+ # omnipay.php
89+ $containerConfigurator->extension('omnipay', [
90+ 'methods' => [
91+ 'CustomGateway' => [
92+ 'apiKey' => 'pa$$w0rd',
93+ ],
94+ ],
95+ ]);
9396` ` `
9497
9598You can then obtain the fully-configured gateway by its alias :
@@ -108,16 +111,19 @@ private function getCustomGateway(OmnipayManager $omnipay): GatewayInteface
108111# ## Default gateway
109112
110113Add default gateway key to your config :
111- ` ` ` yml
112- # omnipay.yaml
113- omnipay:
114- gateways:
115- MyGateway1:
116- apiKey: pa$$w0rd
117- MyGateway2:
118- apiKey: pa$$w0rd
119-
120- default: MyGateway1
114+ ` ` ` php
115+ # omnipay.php
116+ $containerConfigurator->extension('omnipay', [
117+ 'gateways' => [
118+ 'MyGateway1' => [
119+ 'apiKey' => 'pa$$w0rd',
120+ ],
121+ 'MyGateway2' => [
122+ 'apiKey' => 'pa$$w0rd',
123+ ],
124+ ],
125+ 'default' => 'MyGateway1',
126+ ]);
121127` ` `
122128
123129You can now get default gateway instance :
@@ -128,16 +134,21 @@ $omnipay->getDefaultGateway();
128134# ## Disabling gateways
129135
130136If need to disable a gateway but want to keep all the configuration add `disabled` key to the config :
131- ` ` ` yml
132- # omnipay.yaml
133- omnipay:
134- gateways:
135- MyGateway1:
136- apiKey: pa$$w0rd
137- MyGateway2:
138- apiKey: pa$$w0rd
139-
140- disabled: [ MyGateway1 ]
137+ ` ` ` php
138+ # omnipay.php
139+ $containerConfigurator->extension('omnipay', [
140+ 'gateways' => [
141+ 'MyGateway1' => [
142+ 'apiKey' => 'pa$$w0rd',
143+ ],
144+ 'MyGateway2' => [
145+ 'apiKey' => 'pa$$w0rd',
146+ ],
147+ ],
148+ 'disabled' => [
149+ 'MyGateway1',
150+ ],
151+ ]);
141152` ` `
142153
143154` MyGateway1` gateway will be skipped during gateway registration now.
@@ -211,4 +222,4 @@ $ phpunit
211222Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.
212223# # License
213224
214- The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
225+ The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
0 commit comments