silverstripe/dynamodb
Composer 安装命令:
composer require silverstripe/dynamodb
包简介
SilverStripe DynamoDB integration.
关键字:
README 文档
README
This module enables storing SilverStripe sessions in DynamoDB.
Requirements
- SilverStripe 5.0+
- PHP 8.1+
Installation
Add these custom repositories to your composer.json
composer require silverstripe/dynamodb
Sessions with DynamoDB
If you wish to store sessions in DynamoDB, set the required environment variables in .env:
# The name of the DynamoDB table to store sessions in AWS_DYNAMODB_SESSION_TABLE=mysession # The region that the DynamoDB table will live in (in this example here it uses Sydney) AWS_REGION_NAME=ap-southeast-2
Once these are in place, this module will configure DynamoDB and register that as the session handler.
Before you can actually use this, you need to create a table in which to store the sessions. Follow the instructions in the AWS SDK for PHP documentation.
IMPORTANT: You need to set up a TTL attribute for garbage collection in your table. The module does not provide automated garbage collection abilities.
Using DynamoDB outside of AWS
Sometimes you'll want to test that DynamoDB sessions work on your local development environment. You can make that
happen by defining AWS_ACCESS_KEY and AWS_SECRET_KEY. Please don't define these constants in the environment file
in EC2 instances, as credentials are automatically handled by the IAM role inside of AWS.
# The AWS access key and secret. This is optional if you've configured an instance with an IAM role # https://docs.aws.amazon.com/sdk-for-php/v3/developer-guide/guide_credentials.html # Note that AWS_ACCESS_KEY can only contain alphanumeric characters # https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBLocal.DownloadingAndRunning.html#DynamoDBLocal.DownloadingAndRunning.title AWS_ACCESS_KEY=myaccesskey AWS_SECRET_KEY=mysecret
Local Testing
You can simulate DynamoDB locally for easier development through DynamoDB Local.
Set environment constants. Note that actual access keys and regions are ignored, they just need to be defined.
AWS_DYNAMODB_SESSION_TABLE=mysession AWS_ACCESS_KEY=myaccesskey AWS_SECRET_KEY=mysecret AWS_DYNAMODB_ENDPOINT=http://localhost:8000 AWS_REGION_NAME=ap-southeast-2
Download DynamoDB Local
and start it - it'll be available under http://localhost:8000.
Now use the AWS CLI Tools to interact with your local DynamoDB.
Configure user (optional):
You can configure a user to use with the AWS CLI tools. Use this if you are having issues with the environment variables being picked up.
aws configure set aws_access_key_id myaccesskey aws configure set aws_secret_access_key myaccesskey aws configure set default.region ap-southeast-2
Create table:
aws dynamodb create-table --table-name mysession --attribute-definitions AttributeName=id,AttributeType=S --key-schema AttributeName=id,KeyType=HASH --provisioned-throughput ReadCapacityUnits=1,WriteCapacityUnits=1 --endpoint-url http://localhost:8000
List tables:
aws dynamodb list-tables --endpoint-url http://localhost:8000
List all sessions:
aws dynamodb scan --table-name mysession --endpoint-url http://localhost:8000
Delete all sessions (use create table to reset afterwards):
aws dynamodb delete-table --table-name mysession --endpoint-url http://localhost:8000
Contribute
Do you want to contribute? Great, please see the CONTRIBUTING.md guide.
License
This module is released under the BSD 3-Clause License, see license.md.
silverstripe/dynamodb 适用场景与选型建议
silverstripe/dynamodb 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 388.12k 次下载、GitHub Stars 达 4, 最近一次更新时间为 2015 年 07 月 02 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「aws」 「dynamodb」 「silverstripe」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 silverstripe/dynamodb 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 silverstripe/dynamodb 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 silverstripe/dynamodb 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
AWS SDK for PHP - Use Amazon Web Services in your PHP project
AWS package containing services for the DreamFactory Platform 2.0.
This package includes a script and fail2ban configuration that allows you to use fail2ban when utilizing AWS elastic load balancer (ELB) and an apache webserver.
Elastic Driver for Laravel Scout
simple api library.
统计信息
- 总下载量: 388.12k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 16
- 依赖项目数: 6
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2015-07-02