iwai / aws-sdk-php-phalcon
A simple Phalcon service provider for including the AWS SDK for PHP.
Installs: 4 267
Dependents: 0
Suggesters: 0
Security: 0
Stars: 22
Watchers: 5
Forks: 5
Open Issues: 1
Requires
- php: >=5.3.3
- aws/aws-sdk-php: ~2.0
This package is not auto-updated.
Last update: 2024-11-23 14:43:54 UTC
README
A simple Phalcon service provider for including the AWS SDK for PHP.
Installation
{ "require": { "iwai/aws-sdk-php-phalcon": "*" } }
Usage
<?php require __DIR__ . '/vendor/autoload.php'; use Aws\Phalcon\AwsServiceProvider; use Phalcon\Mvc\Application; $app = new Application(); $eventsManager = new Phalcon\Events\Manager(); $app->setEventsManager($eventsManager); $eventsManager->attach("application:boot", new AwsServiceProvider(array( 'key' => 'your-aws-access-key-id', 'secret' => 'your-aws-secret-access-key', 'region' => 'us-east-1', ))); echo $app->handle()->getContent();
Example
// Get the Amazon S3 client $s3 = $this->getDI()->get('aws')->get('s3'); // Create a list of the buckets in your account $buckets = array(); foreach ($s3->getIterator('ListBuckets') as $bucket) { $buckets[] = $bucket['Name']; } var_dump($buckets);