How to load AWS SDK into CakePHP?


I’m creating a S3 plugin for my app. In app/Plugin/S3/Controller/Component/S3Component.php I have these:

In my app’s controller, I call it using $s3 = $this->S3->loadS3();

It throws the error Error: Class 'Aws\S3\S3Client' not found

I tried adding the line: App::uses('Vendor', 'aws/Aws/S3/S3Client'); to the component class, and removed use Aws\S3\S3Client;. It shows Error: Class 'S3Client' not found

The AWS SDK in in the folder app/Plugin/S3/Vendor/aws

I’m loading the S3 object with reference to:


This is how my component looks like now with the help of @akirk.


Clearly the autoimport doesn’t work. You should do it as in the tutorial, use require

as the autoloading mechanism shouldn’t be touched by CakePHP.

Leave a Reply