【问题标题】:using PayWithAmazon with symfony 2 - installed with Composer使用带有 symfony 2 的 PayWithAmazon - 与 Composer 一起安装
【发布时间】:2015-05-07 10:18:00
【问题描述】:

我通过 composer 安装了这个包:

composer require amzn/login-and-pay-with-amazon-sdk-php
composer update

我将此添加到我的控制器文件中: 使用 PayWithAmazon\Client;

...并且希望使用随此包提供的 Client 类。

$amazonClient = new PayWithAmazon\Client($this->amazonCredentials);

框架的错误信息:

ClassNotFoundException in CartController.php line 185: Attempted to load 
    class "Client" from namespace "**Microsite\FrontBundle\Controller\PayWithAmazon**".
Did you forget a "use" statement for e.g.
    "Symfony\Bundle\FrameworkBundle\Client",
    "Symfony\Component\BrowserKit\Client",
    "Symfony\Component\HttpKernel\Client",
    "Guzzle\Service\Client" or "Guzzle\Http\Client"?

`

谁能告诉我我做错了什么? 如何将“客户端”类的命名空间从 Microsite\FrontBundle\Controller\PayWithAmazon 更改为正确的?

(我对其他包没有问题...)

干杯 格雷格

【问题讨论】:

  • 正确的机构:$amazonClient = new \PayWithAmazon\Client($this->amazonCredentials);

标签: php symfony amazon composer-php payment


【解决方案1】:

我建议你关注

use PayWithAmazon\Client as AmazonClient;
...
$amazonClient = new AmazonClient($this->amazonCredentials);

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-04-16
    • 2023-03-30
    • 2012-07-23
    • 1970-01-01
    • 2015-07-03
    • 1970-01-01
    • 2016-04-07
    相关资源
    最近更新 更多