How to get aws service with aws-sfk-php-zf2 v 2.0. *?

Asked

Viewed 16 times

0

I was using aws/aws-sdk-php-zf2 1.2. * and had to update to 2.0. * and now AWS SDK is v3.

Before, I called the service with the code:

$this->s3 = $serviceLocator->get('aws')->get('s3');

But now returns this error:

Zend Servicemanager Servicemanager::get was Unable to fetch or create an instance for aws

I couldn’t identify or find the difference in migration documentation.

Does anyone have any idea?

1 answer

0


I found a way that worked for me.

Now the code is like this:

use Aws\S3\S3Client;

$this->s3 = S3Client::factory(array(
            'credentials' => array(
               'key' => $this->config['aws']['key'],
               'secret' => $this->config['aws']['secret'],
            ),
            'region' => $this->config['aws']['region'],
            'version' => '2006-03-01'
        ));

Browser other questions tagged

You are not signed in. Login or sign up in order to post.