iwai/aws-sdk-php-phalcon

一个简单的Phalcon服务提供程序,用于包含AWS SDK for PHP。

0.1.1 2015-09-21 04:42 UTC

This package is not auto-updated.

Last update: 2024-09-14 13:50:43 UTC


README

Latest Stable Version Total Downloads Latest Unstable Version License

一个简单的Phalcon服务提供程序,用于包含AWS SDK for PHP。

安装

{
    "require": {
        "iwai/aws-sdk-php-phalcon": "*"
    }
}

使用方法

<?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();

示例

// 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);