Skip to content

Commit

Permalink
Merge pull request #10 from dhensby/pulls/add-get-handler
Browse files Browse the repository at this point in the history
NEW Adding getHandler to allow access to DynamoDBHandler
  • Loading branch information
Stig Lindqvist committed Nov 23, 2015
2 parents b154256 + 14b302a commit 1336a57
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,15 @@ If you wish to store sessions in DynamoDB, set the following environment variabl
define('AWS_REGION_NAME', 'ap-southeast-2');

Once these are in place, this module will configure DynamoDB and register that as the session handler.
You will **need** to create the specified table using the AWS DynamoDB console for the region.

To create a DynamoDB session table you can execute the following code:

```php
DynamoDbSession::get()->getHandler()->createSessionsTable(5,5);
```

See http://docs.aws.amazon.com/aws-sdk-php/v2/guide/feature-dynamodb-session-handler.html#create-a-table-for-storing-your-sessions
for more information about `createSessionsTable`

## Using DynamoDB outside of AWS

Expand Down
11 changes: 9 additions & 2 deletions code/model/DynamoDbSession.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<?php

require_once __DIR__ . '/../../../vendor/autoload.php';

use Aws\DynamoDb\DynamoDbClient;
use Aws\DynamoDb\Session\SessionHandler;

Expand All @@ -22,6 +20,15 @@ class DynamoDbSession
*/
protected $handler;

/**
* Getter for SessionHandler
*
* @return SessionHandler
*/
public function getHandler() {
return $this->handler;
}

/**
* Get an instance of DynamoDbSession configured from the environment if available.
* @return null|DynamoDbSession
Expand Down

0 comments on commit 1336a57

Please sign in to comment.