【问题标题】:Composer.json Installation On AWS Elastic Beanstalk在 AWS Elastic Beanstalk 上安装 Composer.json
【发布时间】:2017-03-26 11:21:33
【问题描述】:

我在 AWS Elastic Beanstalk 文档中读到,您可以简单地将 composer.json 文件包含在包的根目录中,它将安装一个应用程序及其依赖项:

http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_PHP.container.html#php-configuration-composer

{
    "require": {
        "coinbase/coinbase": "~2.0"
    }
}

然后我用以下内容创建了一个 PHP 文件来测试它是否有效:

error_reporting(E_ALL);
ini_set('display_errors', 1);

$apiKey = 'workingkey';

$apiSecret = 'workingkey';

use Coinbase\Wallet\Client;
use Coinbase\Wallet\Configuration;

$configuration = Configuration::apiKey($apiKey, $apiSecret);
$client = Client::create($configuration);

$buyPrice = $client->getBuyPrice('BTC-USD');

echo $buyPrice;

不幸的是,它给出了以下错误:

Fatal error: Uncaught Error: Class 'Coinbase\Wallet\Configuration' not found in /var/app/current/test.php:20 Stack trace: #0 {main} thrown in /var/app/current/test.php on line 20

我已经尝试了所有我能想到的方法来让它发挥作用。我在这里错过了什么?

【问题讨论】:

    标签: php amazon-web-services composer-php amazon-elastic-beanstalk coinbase-php


    【解决方案1】:

    你错过了包含作曲家的自动加载器。

    在文件的开头添加它,它应该可以工作:

    require __DIR__.'/vendor/autoload.php';
    

    【讨论】:

      猜你喜欢
      • 2013-07-08
      • 2018-07-01
      • 2021-01-07
      • 2015-04-03
      • 2018-05-25
      • 2016-03-11
      • 2020-10-13
      • 2014-10-15
      • 2021-02-01
      相关资源
      最近更新 更多