在创建aws-sdk-php客户端时指定版本

时间:2015-10-19 16:53:40

标签: php laravel amazon-web-services laravel-4 amazon-s3

我正在使用Laravel Stapler将模型附件保存到s3。通过文档阅读我提出了以下代码并将其粘贴在模型的save方法中。

        $this->hasAttachedFile('recording', [
            'url' => '/recording/:attachment/:id_partition/:style/:filename',
            'storage' => 's3',
            's3_client_config' => [
                'key' => 'accessKey',
                'secret' => 'secretKey',
                'region' => 'us-east-1'
            ],
            's3_object_config' => [
                'Bucket' => 'bucket.aws.com'
            ],
        ]);

当我find()模型时,设置附件,然后运行save()我得到:

PHP Fatal error: Uncaught exception 'InvalidArgumentException' with message 'version is a required configuration setting when creating a client.' in /Users/myName/Code/projectName/vendor/aws/aws-sdk-php/src/Common/ClientFactory.php:99

ClientFactory create()方法需要设置“版本”。通过laravel-stapler和stapler文档查看我没有看到任何提及版本的内容。我正在使用最新版本的laravel-stapler和laravel 4.

这里有什么我想念的吗?

1 个答案:

答案 0 :(得分:0)

即使文档中没有,我在配置s3时也必须添加一个版本。

    private KeyboardView mInputView;
    @Override
    public KeyboardView onCreateInputView() {
        mInputView = (KeyboardView)getLayoutInflater().inflate(R.layout.keyboard, null);
        mInputView .setPreviewEnabled(false);
        return mInputView;
    }