Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Hang the Amazon AWS SDK in Phalcon PHP
AWS SDK uses a lot of third-party libraries and Framework, so the namespace to manually handle the words will be more trouble, I suggest using Composer to deal with these things, it uses spl_autoload to deal with, so the class will be used in the time to load, Fast and concise.
Under the project put composer.json, the content is
{
"require": {
"aws/aws-sdk-php": "dev-master"
}
}
Download composer.phar placed under the project
wget http://getcomposer.org/composer.phar
Install the AWS SDK, he will be in the project under a vendor directory, and AWS and dependencies will be placed here
php composer.phar install
Modify public / index.php, plus program segments
require __DIR__ . '/../vendor/autoload.php';
All the way to the side, generally on the end, and then you can add a profile, you can use the project can be used directly
After Amazon applies for KEY, edit app / config / config.php plus
'aws' => array( 'key' => 'XXXXXXXXX', 'secret' => 'YYYYYYYYY', ),
I use the Amazon SES service to a simple test, I will SES made a service, so that we can access directly in other programs
編輯 app/config/service.php
$di->set('AWSSES', function() use ($config) {
$SES = Aws\Ses\SesClient::factory(array(
'key' => $config->aws->key,
'secret'=> $config->aws->secret,
'region'=> 'us-east-1',
));
return $SES;
});
We can use the SES service directly in the Controller
$client = $this->di->get('AWSSES');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.