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

0

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

Before, I called the service with the code:

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

But now it returns this error:

  

Zend \ ServiceManager \ ServiceManager :: get was unable to fetch or create an instance for aws

I could not identify or find the difference in the migration documentation.

Does anyone have any ideas?

    
asked by anonymous 29.11.2017 / 15:01

1 answer

0

I found a way that worked for me.

Now the code looks 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'
        ));
    
30.11.2017 / 18:04