urbanindo/yii2-dynamodb
Composer 安装命令:
composer require urbanindo/yii2-dynamodb
包简介
DynamoDB extensions for Yii2
README 文档
README
This is a DynamoDB extension for Yii2
Requirement
This extension requires
- PHP minimum 7.0 and before 7.2 (Upgrade is still underwork)
- Yii2 minimum 2.0.13 and lesser than 2.1
- AWS PHP SDK 3.28
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist urbanindo/yii2-dynamodb "*"
or add
"urbanindo/yii2-dynamodb": "*"
to the require section of your composer.json file.
Setting Up
After the installation, sets the dynamodb component in the config.
return [ // ... 'components' => [ // ... 'dynamodb' => [ 'class' => 'UrbanIndo\Yii2\DynamoDb\Connection', 'config' => [ //This is the config used for Aws\DynamoDb\DynamoDbClient::factory() //See http://docs.aws.amazon.com/aws-sdk-php/v2/guide/service-dynamodb.html#factory-method 'credentials' => [ 'key' => 'YOUR_AWS_ACCESS_KEY_ID', 'secret' => 'YOUR_AWS_SECRET_ACCESS_KEY', ], 'region' => 'ap-southeast-1', ] ] ], ];
Limitation
Because DynamoDB have different behavior from MySQL, there are several limitations or behavior change applied. There are several method to get data from DynamoDB: GetItem, BatchGetItem, Scan, and Query.
- We have tried to implement automatic method to acquire model from Query. You should assign method explicitly if you want to force the method to use.
- Not yet support attribute name aliasing (In MySQL known as field aliasing).
- When using Query method, where condition just support filter by key attributes. In next roll out we will add filtering with non key attributes.
- To make pagination, we forcedly using Query method when WHERE condition is set. Because if you use filtering with non key attribute, it is possible the model result(s) will less than desired limit value.
indexByandorderBycannot use with attribute string value or callable parameter. This will use as string value and assign toIndexNameparameter in DynamoDB. To use sorting, this will forcedly use QUERY method andorderByparameter should be either['myIndex' => 'ASC']or['myIndex', 'DESC']and key condition expression should be defined.- Not support NULL and any kind of set attribute type.
- Not support attribute aliasing belong to Reserve Keywords, which means all attributes do not using any Reserve Keywords.
- When use LinkPager, do not forget use ActiveDataProvider from this package. When the pagination pass into any kind of Widget View, several components maybe unsupported like SerialColumn, unnecessary total items in summary, and sorting.
urbanindo/yii2-dynamodb 适用场景与选型建议
urbanindo/yii2-dynamodb 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 72.12k 次下载、GitHub Stars 达 14, 最近一次更新时间为 2015 年 09 月 14 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 urbanindo/yii2-dynamodb 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 urbanindo/yii2-dynamodb 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 72.12k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 14
- 点击次数: 6
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD
- 更新时间: 2015-09-14