问题
Does anyone know how I could add a new payment gateway to Omnipay?
I read the blog https://groups.google.com/forum/#!topic/omnipay/j7OeQQSB95A
I followed the following steps:
- Cloned the Omnipay repository using composer
- Inside the vendor/Omnipay/ directory, added the new directory layout as per the stripe example
Now when am now trying to include my gateway, I see the following error:
SCREAM: Error suppression ignored for
( ! ) Fatal error: Class '\Omnipay\Mygateway\Gateway' not found in
C:\wamp\www\root\omnipay\vendor\omnipay\common\src\Omnipay\Common\GatewayFactory.php on line 79
回答1:
You don't need to change anything inside the vendor/
directory.
Just create a class \Omnipay\MyGateway\Gateway
in your regular src/lib directory, and make sure it can be autoloaded by composer. Then you can use Omnipay\Omnipay::create('MyGateway')
to create an instance of the class (or simply call new \Omnipay\MyGateway\Gateway()
).
来源:https://stackoverflow.com/questions/22216904/omnipay-how-to-add-new-gateway