2015-10-19 31 views
0

我使用Laravel Stapler將模型附件保存到s3。通過閱讀文檔,我想出了以下代碼,並將其粘貼在模型的保存方法中。創建aws-sdk-php客戶端時指定版本

 $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 4的最新版本的laravel-stapler。

有沒有我在這裏失蹤的東西?

回答

0

即使它不在文檔中,我在配置s3時也必須添加一個版本。

 's3_client_config' => [ 
      'key' => 'accessKey', 
      'secret' => 'secretKey', 
      'region' => 'us-east-1', 
      'version' => 'latest', 
     ],