en0ma/rumble 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

en0ma/rumble

Composer 安装命令:

composer require en0ma/rumble

包简介

A dynamodb migration tool

README 文档

README

A php migration tool for AWS dynamoDB.

Requirements

To use rumble for migration and seeding, you should either have aws dymanodb locally installed or have a valid aws credential for the remote version in a particular aws region.

Disclosure

rumble is far from being complete compared to other migration tool out there. More features will be added in the future.

Naming Convention

Since rumble is still in its infancy, it cannot generate migration or seeder file automatically. You have to manually create files for both migrations and seeds. Migration and Seed files are to be placed in migrations and seeds directories at the root of your project.

A migration or seed file must be named with an underscore (_) separating each word that makes up the file name. e.g: creat_app_records_table.php, is a valid file name for a migration or a seed file.

While the file name uses underscore (_) naming style, the class name for the creat_app_records_table.php file uses PasCal naming style. i.e the first letter of every word that makes up the file name must be capitalized e.g: CreateAppRecordsTable.

Class Definition

  • Migration: Every migration file (class) you create must extend the rumble Migration class and must define a up method.
  • Seed: Every seed file (class) you create must extend the rumble Seeder class and must define a seed method.

Using Rumble

  • Migration: to migrate files, run rumble migrate from the root directory of your project. e.g: vendor/bin/rumble migrate
  • Seed: to seed files, run rumble seed from the root directory of your project e.g vendor/bin/rumble seed

Supported DynamoDb Features

Currently, rumble supports only the below dynamodb features;

  • Create table
  • Update table
  • Delete table
  • Add Item
  • Batch Write Item

Tutorial - Create a new table

The below code sample shows the minimum required params to create a dynamodb table using rumble. This is from the up method of the migration file (create_app_records_table.php). The up method, is the only required method to be implemented by every migration file you create.

<?php
use Rumble/Migration;

class CreateAppRecordsTable extends Migration
{
    public funtion up()
    {
        $table = $this->table('app_records'); //table name
        $table->addAttribute('app_uid', 'S'); //primary key data type - String(S)
        $table->addHash('app_uid');  //primary key
        $table->setWCU(10); //Write Capacity Unit (Provisioned write throughPut)
        $table->setRCU(10); //Read Capacity Unit (Provisioned read throughPut)
        $table->create();  //create table
    }
}

Tutorial - Seed table

The below sample code shows the minimum required params to seed a dynamodb table (sample created above). This is from the seed method of the seed file (app_records_seeder.php). The seed method is the only required method to be implemented by every seed file you create

<?php
use Rumble/Seeder;

class AppRecordsTableSeeder extends Seeder 
{
    public function seed()
    {
        $table = $this->table('app_records');
        $table->addItem(['app_uid' => 'x435-n956-00jX-u2fX', 'uninstall' => ['reason' => 'Still thinking of one.']);
        $table->addItem(['app_uid' => '944-jjU0-o0Hi-y4hh4', 'events' => ['action' => 'click', 'date' => '2017-04-10']]); 
        $table->save();
    }
}

Database Configuration

rumble uses a rumble.php file as its configuration file. You have to create this file at the root of your project. This file must return an array with your dynamodb configuration. e.g:

<?php

return [
    'region' => '',
    'key' => '',
    'secret' => '',
    'endpoint' => ''
 ];

en0ma/rumble 适用场景与选型建议

en0ma/rumble 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 398 次下载、GitHub Stars 达 6, 最近一次更新时间为 2017 年 04 月 11 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「php」 「migration」 「dynamodb」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 en0ma/rumble 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 en0ma/rumble 我们能提供哪些服务?
定制开发 / 二次开发

基于 en0ma/rumble 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 398
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 6
  • 点击次数: 11
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 6
  • Watchers: 1
  • Forks: 8
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-04-11