0

我使用 composer 来加载 Ominpay-nmi 所需的所有内容。我没有收到作曲家错误,但是当我运行时

use Omnipay\Omnipay;
$gatewayObj = Omnipay::create("NMI");

我收到消息 Fatal error: Uncaught exception 'Omnipay\Common\Exception\RuntimeException' with message 'Class '\Omnipay\NMI\Gateway' not found' in /home/ken/NetBeansProjects/tournament/vendor/omnipay/common/src /Omnipay/Common/GatewayFactory.php 第 105 行

我尝试按照建议创建一个空类

代码如下:

<?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 的示例(这将是我的下一个网关实现)将不胜感激。

谢谢

4

1 回答 1

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");
于 2015-10-29T04:31:28.160 回答