platinumpixs / aws-symfony2-bundle

一个简单的用于包含 AWS SDK for PHP 的 Symfony 2 Bundle。

1.3.0 2015-08-06 04:22 UTC

This package is not auto-updated.

Last update: 2024-09-14 14:24:30 UTC


README

此包不再更新 - 请参阅 Amazon AWS 直接提供的包

https://github.com/aws/aws-sdk-php-symfony

AWS SDK 2 - Symfony 2 Bundle

Build StatusLatest Stable Version Total Downloads Latest Unstable Version License

提供简单的 Symfony 2 Bundle,用于包装 AWS PHP SDK 2 - https://github.com/aws/aws-sdk-php

通过 Composer 安装

这将安装 SDK 的第 3 版。

{
    "require": {
        "platinumpixs/aws-symfony2-bundle": "dev-master"
    }
}

如果您想保持在较旧的 SDK 第 2 版上。

{
    "require": {
        "platinumpixs/aws-symfony2-bundle": "1.2.0"
    }
}

使用和设置

autoload.php

$loader->registerNamespaces(
  'PlatinumPixs'                  => __DIR__ . '/../vendor/platinumpixs'
)

Kernel.php

public function registerBundles() {
  $bundles = array(
    new PlatinumPixs\Aws\PlatinumPixsAwsBundle()
  );
}

代码调用 \Aws\Common\Aws::factory(),这设置了调用库中提供所有服务的能力

始终在以下位置设置一个基本类

$this->get('platinum_pixs_aws.default');

这将使用空白配置值调用工厂方法

要提供访问、密钥的定制设置,请在 config.yml 中添加配置选项,例如

platinum_pixs_aws:
    base:
        region: us-east-1
        key: my-access-key
        secret: my-secret-key

然后,要访问此设置,请调用

$this->get('platinum_pixs_aws.base');