4

我正在尝试将 Omnipay Paypal 包与我的 Laravel 4.1 应用程序集成。我已经按照 Omnipay 的建议安装了laravel-omnipay 包,并按照说明进行了设置。

我已将 laravel-omnipay 包添加到 Laravel 的 app.php 文件中的 providers 数组和 aliases 数组中。配置文件也已创建。

我的 composer.json 有以下要求:

"ignited/laravel-omnipay": "1.*",
"omnipay/paypal": "~2.0"

ignited/laravel-omnipay 的配置文件如下所示:

<?php

return array(

    // The default gateway to use
    'default' => 'paypal',

    // Add in each gateway here
    'gateways' => array(
        'paypal' => array(
            'driver' => 'Paypal_Express',
            'options' => array(
                'solutionType' => '',
                'landingPage' => '',
                'headerImageUrl' => ''
            )
        )
    )
);

但是当我打电话时,$gateway = Omnipay::gateway('paypal');我得到了错误

类 '\Omnipay\Paypal\ExpressGateway' 未找到”

有什么我忘记了吗?:我

4

2 回答 2

5

I'm not familiar with ignited/laravel-omnipay specifically, so this may or may not be the problem, but you might try fixing the capitalisation on this line:

'driver' => 'PayPal_Express',

(note that PayPal has two capital P's).

Generally class names are not case sensitive in PHP, but if you are using a case-sensitive filesystem, then the composer autoloader will not be able to find the right class.

于 2014-03-05T23:54:55.570 回答
0

尝试composer dumpautoload加载新类。

更新:

考虑一下新包为您的应用程序提供的服务条款。查找链接到应用程序的服务在哪里。它通常通过 ServiceProviders 类完成。如果没有错误,应该很容易,按照简单的业务规则来查看提供程序与主应用程序的关系。因此,您有一个实体(提供者)应该与另一个实体(提供者)进行通信。这种沟通是通过简单的规则完成的。这是学习 Laravel 的最佳方式。它有助于从业务规则的角度进行思考,而不是盯着通常非常抽象的代码。

于 2014-02-26T20:26:29.800 回答