Arco Voltaico
Arco Voltaico

Reputation: 814

Composer installed Amazon AWS SES PHP Classes not available

I can't use the AWS SES PHP Classes although I already installed the AWS PHP 2 SDK via composer.

The PHP at root level is:

require __DIR__ . '/vendor/autoload.php'; //esto añade lo que gestiona composer
use Aws\Common\Aws;
use Aws\Ses\SesClient;
$client = SesClient::factory(
                array(
                    'key' => $userid,
                    'secret' => $secret,
                    'region' => 'us-east-1' // SES has only us-east-1 endpoint, but can be used from global
                )
);

Browser execution is returning this:

Fatal error: Class 'Aws\Common\Aws\Ses\SesClient' not found in /homepages/13/d357210024/htdocs/api/sendses.php on line 41

The composer.json at root is just this:

{
    "require": {
        "aws/aws-sdk-php": "2.*"
    }
}

and the /vendor folders contain the aws, composer, guzzle and symfony packages along with the autoload.php that contains only this code:

<?php

// autoload.php @generated by Composer

require_once __DIR__ . '/composer' . '/autoload_real.php';

return ComposerAutoloaderInita6b8287c70832f4f8a65e83c0ad07b6d::getLoader();

So... Could you point what I'm missing here? Thank so much mates.

Upvotes: 2

Views: 7909

Answers (1)

Ryan Parman
Ryan Parman

Reputation: 6945

The problem is simpler than that. You have:

use Aws\Common\Aws;
use Aws\Ses\SesClient;

With this, you've redefined the Aws namespace to mean something different the second time. If you're not actually using Aws\Common\Aws, then don't use it.

require __DIR__ . '/vendor/autoload.php';

use Aws\Ses\SesClient;

$client = SesClient::factory(array(
    'key'    => $userid,
    'secret' => $secret,
    'region' => 'us-east-1',
));

Upvotes: 4

Related Questions