Skip to content

Commit

Permalink
Slightly simplified the module setup
Browse files Browse the repository at this point in the history
- Removed the dist config file and getConfig() method from Module class.
- Added README with sample configuration and usage.
  • Loading branch information
EvanDotPro committed Feb 21, 2013
1 parent 51746ba commit ac1e72f
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 22 deletions.
10 changes: 0 additions & 10 deletions Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,6 @@
*/
class Module implements ConfigProviderInterface, ServiceProviderInterface
{
/**
* {@inheritdoc}
*/
public function getConfig()
{
return array(
'aws' => array()
);
}

/**
* {@inheritdoc}
*/
Expand Down
62 changes: 62 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
<?php
return array(
// These are the minimum required settings for using the SDK
'aws' => 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).
12 changes: 0 additions & 12 deletions config/aws.global.php.dist

This file was deleted.

0 comments on commit ac1e72f

Please sign in to comment.