我使用composer来加载Ominpay-nmi以及它所需的全部内容。我没有得到作曲家的错误,但是当我跑步时
use Omnipay\Omnipay;
$gatewayObj = Omnipay::create("NMI");
我收到了消息 致命错误:未捕获的异常' Omnipay \ Common \ Exception \ RuntimeException'消息' Class' \ Omnipay \ NMI \ Gateway'找不到'在第105行的/home/ken/NetBeansProjects/tournament/vendor/omnipay/common/src/Omnipay/Common/GatewayFactory.php
我尝试按照
中的建议创建一个空类代码如下:
<?php
namespace Omnipay\myNMIGateway;
class Gateway {
//put your code here
}
作曲家代码
{
"name":"x/x",
"description":"autoload for tournament software",
"license":"",
"require": {
"php": ">=5.3.0",
"ext-curl": "*",
"ext-json": "*",
"paypal/rest-api-sdk-php" : "dev-master",
"mfauveau/omnipay-nmi": "~2.0",
"twilio/sdk": "dev-master",
"mailgun/mailgun-php": "dev-master",
"components/jqueryui":">=1.11.4",
"bacon/bacon-qr-code": "dev-master"
},
"autoload":{
"files":["tournamentConfig.php"],
"psr-4":{"mts\\classes\\":"classes",
"mts\\classes\\tables\\":"classes/tables/src",
"mts\\":"classes\\factories",
"mts\\":"classes\\data",
"mts\\":"classes\\view",
"mts\\":"classes\\keys",
"mts\\view\\":"view",
"mts\\model\\":"model"
}
}
}
任何特定于NMI和Paypal的示例(这将是我的下一个网关实现)将不胜感激。
谢谢
肯
答案 0 :(得分:3)
mfauveau / omnipay-nmi中的类文件如下所示:
namespace Omnipay\NMI;
use Omnipay\Common\AbstractGateway;
class DirectPostGateway extends AbstractGateway
所以要加载它你应该这样做:
$gatewayObj = Omnipay::create("NMI_DirectPost");
PayPal REST网关的文档相当完整,可以加载您应该使用的文档:
$gatewayObj = Omnipay::create("PayPal_Rest");