Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pfazzi/dynamo-db-session
DynamoDB Session is a session handler that stores session data in DynamoDB.
https://github.com/pfazzi/dynamo-db-session
dynamodb php session symfony
Last synced: 20 days ago
JSON representation
DynamoDB Session is a session handler that stores session data in DynamoDB.
- Host: GitHub
- URL: https://github.com/pfazzi/dynamo-db-session
- Owner: pfazzi
- Created: 2020-12-24T14:58:48.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2021-01-05T15:26:29.000Z (almost 4 years ago)
- Last Synced: 2024-09-21T16:29:41.714Z (about 2 months ago)
- Topics: dynamodb, php, session, symfony
- Language: PHP
- Homepage:
- Size: 13.7 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# DynamoDB Session
DynamoDB Session is a session handler that stores session data in DynamoDB.
## Installation
Use the package manager [composer](https://getcomposer.org/) to install DynamoDB Session.
```bash
composer require pfazzi/dynamo-db-session
```## Usage
Define a proper service in `config/services.yaml`
```yaml
services:
pfazzi.dynamo_db_session:
class: Pfazzi\Session\DynamoDb\DynamoDbSessionHandler
arguments:
$tableName: 'dashboard-session-dev' # TODO: change me!
```
A DynamoDb table needs to exist in the configured region with the given `$tableName` option.
The primary key of the table must be a String with key "id".Tell Symfony to use it as session handler in `config/packages/framework.yaml`:
```yaml
framework:
session:
handler_id: pfazzi.dynamo_db_session
```### Create session table programmatically
You can programmatically create the session table using `Pfazzi\Session\DynamoDb\SessionTable` class, as in the following example:
```php
$tableName = 'some-session-table-name';$sdk = new Aws\Sdk([
'region' => 'eu-central-1',
'version' => 'latest',
]);$dynamodb = $sdk->createDynamoDb();
$sessionTable = new Pfazzi\Session\DynamoDb\SessionTable($dynamodb, $tableName);
$sessionTable->create();
```## Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.Please make sure to update tests as appropriate.
## License
[MIT](https://choosealicense.com/licenses/mit/)