Check this out for an extension that does exactly what you need to do.
Integrate AWS SDK with PHP 2 with Yii Framework
-
30-05-2022 - |
Question
I'm trying to integrate AWS SDK for PHP 2
with Yii Framework
.
I downloaded the ZIP AWS SDK and unzipped on: /protected/vendors/aws
public function actionTestS3() {
Yii::import('application.vendors.aws.aws-autoloader');
$client = S3Client::factory(array(
'key' => 'XXXX',
'secret' => 'YYYY',
));
}
Error:
include(S3Client.php): failed to open stream: No such file or directory
Its not load properly, can someone help me to find how to do that?
Solution 2
OTHER TIPS
This worked for me:
Yii::setPathOfAlias('Aws',Yii::getPathOfAlias('application.vendors.aws.Aws'));
Yii::setPathOfAlias('Guzzle',Yii::getPathOfAlias('application.vendors.aws.Guzzle'));
Yii::setPathOfAlias('Symfony',Yii::getPathOfAlias('application.vendors.aws.Symfony'));
Yii::import('application.vendors.aws.aws-autoloader.*');
use Aws\S3\S3Client;
Hope this saves someone else time
In your config main.php import the files u need to use .IN which folder u have S3Client.php u have to import those files
For Example
'import'=>array(
'application.vendors.aws.aws-autoloader.*',
),
Hope this may help u
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow