I installed AWS PHP SDK v3 based on http://docs.aws.amazon.com/aws-sdk-php/v3/guide/getting-started/installation.html using composer method. Tried a simple example but getting this error:
PHP Fatal error: Uncaught Error: Class 'Aws\Common\Aws' not found in test.php
Code:
<?php
// Include the SDK using the Composer autoloader
require 'vendor/autoload.php';
use Aws\Common\Aws;
$aws = Aws::factory('./cfg.php');
/* CODE BELOW WORKS FINE BY ITSELF
$s3 = new Aws\S3\S3Client([
'version' => 'latest',
'region' => 'us-west-1',
'credentials' => [
'key' => '***',
'secret' => '***'
],
]);
$result = $s3->listBuckets();
foreach ($result['Buckets'] as $bucket) {
// Each Bucket value will contain a Name and CreationDate
echo "{$bucket['Name']} - {$bucket['CreationDate']}
";
}
*/
?>
My PHP version:
PHP 7.1.0alpha2 (cli) (built: Jun 27 2016 22:39:02) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.1.0-dev, Copyright (c) 1998-2016 Zend Technologies
I tried including aws.phar instead but still did not work.