jeudi 15 mai 2014

Symfony2 - compositeur installé Amazon AWS SES Classes PHP non disponible - Stack Overflow


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.




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',
));


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.



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',
));

0 commentaires:

Enregistrer un commentaire