AWS SDK PHP2- Guzzle Service Builder


AWS SDK PHP2- Guzzle Service Builder

我正在尝试摆脱我当前的身份验证模型:

$s3_cfg = S3Client::factory(array(
    'key' => 'access',
    'secret' => 'secret'
             ));

并使用Guzzle Service模型(http://docs.aws.amazon.com/aws-sdk-php-2/guide/latest/service-s3.html#service-定位器)

以下是我目前所拥有的:

require '../s3up/vendor/autoload.php';
 use Aws'Common'Aws;
 $aws = Aws::factory('api.json');
 $client = $aws>get('apiauth');

和我的api.json:

{
"includes": ["_aws"],
"services": {
  "apiauth": {
      "params": {
          "key": "access",
          "secret": "secret",
          "region": "us-west-2"
      }
  }
}
}

出于任何原因,我收到了一个错误500和以下错误消息:

 Class '' not found in /s3up/vendor/guzzle/guzzle/src/Guzzle/Service/Builder/ServiceBuilder.php on line 141

我使用composer安装了AWS php SDK2。如果我只是删除服务定位器并使用基本的身份验证,一切都可以,所以我的autoload.php 没有任何问题

我从http://docs.aws.amazon.com/awssdkdocsphp2/latest/gettingstartedguide/sdk-php2-using-the-sdk.html#sdk-php2使用服务生成器

感谢

如果您希望这些键用于构建器创建的所有服务,那么您应该将"apiauth"更改为"default_settings"。然后,您将调用$aws->get('s3')来获得一个具有共享凭据的AmazonS3客户端。