From ac1e72f8926460f7faa92613582cbd22817edb85 Mon Sep 17 00:00:00 2001 From: Evan Coury Date: Thu, 21 Feb 2013 14:01:20 -0700 Subject: [PATCH] Slightly simplified the module setup - Removed the dist config file and getConfig() method from Module class. - Added README with sample configuration and usage. --- Module.php | 10 ------ README.md | 62 ++++++++++++++++++++++++++++++++++++++ config/aws.global.php.dist | 12 -------- 3 files changed, 62 insertions(+), 22 deletions(-) create mode 100644 README.md delete mode 100644 config/aws.global.php.dist diff --git a/Module.php b/Module.php index 2c637fb..c9d382a 100644 --- a/Module.php +++ b/Module.php @@ -12,16 +12,6 @@ */ class Module implements ConfigProviderInterface, ServiceProviderInterface { - /** - * {@inheritdoc} - */ - public function getConfig() - { - return array( - 'aws' => array() - ); - } - /** * {@inheritdoc} */ diff --git a/README.md b/README.md new file mode 100644 index 0000000..90b5eb4 --- /dev/null +++ b/README.md @@ -0,0 +1,62 @@ +# AWS SDK ZF2 Module +Version 0.1 + +## Introduction + +This module provides a simple wrapper for the AWS PHP SDK library. It registers +the AWS service builder as a service in the service manager, making it easily +accessible anywhere in your application. + +## Installation + +Add your secret/public keys and region to your local config file +(`config/autoload/aws.local.php` for example): + +```php + array( + 'key' => 'change_me', + 'secret' => 'change_me', + 'region' => 'change_me' + ), + + // Instead of defining settings in this file, you can provide a path to an AWS SDK for PHP config file + // 'aws' => 'path/to/aws-config.php', +); +``` + +## Usage + +```php +public function indexAction() +{ + $aws = $this->getServiceLocator()->get('aws'); + $client = $aws->get('dynamodb'); + + $table = 'posts'; + + // Create a "posts" table + $result = $client->createTable(array( + 'TableName' => $table, + 'KeySchema' => array( + 'HashKeyElement' => array( + 'AttributeName' => 'slug', + 'AttributeType' => 'S' + ) + ), + 'ProvisionedThroughput' => array( + 'ReadCapacityUnits' => 10, + 'WriteCapacityUnits' => 5 + ) + )); + + // Wait until the table is created and active + $client->waitUntil('TableExists', array('TableName' => $table)); + + echo "The {$table} table has been created.\n"; +} +``` + +See the full PHP SDK documentation [here](http://docs.aws.amazon.com/awssdkdocsphp2/latest/gettingstartedguide/sdk-php2-using-the-sdk.html). diff --git a/config/aws.global.php.dist b/config/aws.global.php.dist deleted file mode 100644 index 8f59216..0000000 --- a/config/aws.global.php.dist +++ /dev/null @@ -1,12 +0,0 @@ - array( - 'key' => 'change_me', - 'secret' => 'change_me', - 'region' => 'change_me' - ), - - // Instead of defining settings in this file, you can provide a path to an AWS SDK for PHP config file - // 'aws' => 'path/to/aws-config.php', -);