vendredi 17 avril 2015

How to work with aws-sdk-php in zf2 project?

actually i know that there is a aws-sdk-php for zf2 which is named aws-sdk-php-zf2 , but i have a part using the simple sdk and i would like to work with it inside my zf2 controllers without having 2 sdk ; one for simple php and other for zf2 scripts ... is that any way to make it work ? Here is the way i work using the aws-sdk in a simle php script :



require 'vendor/autoload.php';
use Aws\S3\S3Client;
use Aws\S3\Exception\S3Exception;
// Instantiate an S3 client
$client = S3Client::factory(array(
'credentials' => array(
'key' => 'key',
'secret' => 'secret_key',
)
));
$bucket = 'bucket_name';
$keyname = 'project_name/file.ext';

$result = $client->deleteObject(array(
'Bucket' => $bucket,
'Key' => $keyname
));
print_r($result);


thanks.





Aucun commentaire:

Enregistrer un commentaire