定制 likeuntomurphy/serverless-ogm-bundle 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

likeuntomurphy/serverless-ogm-bundle

Composer 安装命令:

composer require likeuntomurphy/serverless-ogm-bundle

包简介

Symfony bundle for the Serverless OGM

README 文档

README

Symfony integration for the Serverless OGM. Registers the DocumentManager, discovers document classes automatically, and provides a DynamoDB profiler panel for the Symfony toolbar.

Installation

composer require likeuntomurphy/serverless-ogm-bundle

Configuration

# config/packages/serverless_ogm.yaml
serverless_ogm: ~

The defaults connect to DynamoDB using the standard AWS credential chain (IAM role on Lambda, environment variables locally). Override for local development:

# config/packages/serverless_ogm.yaml
when@dev:
    serverless_ogm:
        dynamodb:
            endpoint: '%env(DYNAMODB_ENDPOINT)%'
            credentials:
                key: 'local'
                secret: 'local'

Full configuration reference

serverless_ogm:
    dynamodb:
        region: 'us-east-1'     # AWS region (default: us-east-1)
        endpoint: ~              # Override for DynamoDB Local
        credentials:
            key: ~               # Explicit access key (default: null, uses credential chain)
            secret: ~            # Explicit secret key
    table_suffix: ''             # Appended to all table names (e.g. '_test')
    default_billing_mode: 'PAY_PER_REQUEST'  # PAY_PER_REQUEST or PROVISIONED
    tables:                      # Per-table overrides (keyed by table name from #[Document])
        sessions:
            billing_mode: 'PROVISIONED'
            rcu: 10              # ReadCapacityUnits (default: 5)
            wcu: 5               # WriteCapacityUnits (default: 5)

Document discovery

The bundle uses Symfony 7.3+ resource tags to discover document classes. Any class with the #[Document] attribute is automatically registered with the MetadataFactory and excluded from the service container — no directory scanning, no explicit class lists.

use Likeuntomurphy\Serverless\OGM\Mapping\Document;
use Likeuntomurphy\Serverless\OGM\Mapping\Field;
use Likeuntomurphy\Serverless\OGM\Mapping\PartitionKey;

#[Document(table: 'users', pk: 'PK')]
class User
{
    #[PartitionKey]
    public string $email;

    #[Field]
    public string $name;
}

No further configuration needed. The class is discovered, mapped, and excluded from the container automatically.

Services

The bundle registers the following services, all autowirable:

Service Description
DocumentManager The main persistence interface. Tagged with kernel.reset to clear the identity map between requests.
MetadataFactory Holds metadata for all registered document classes.
DynamoDbClient The AWS SDK client, configured from the bundle config.

Table creation

Create DynamoDB tables for all mapped documents:

php bin/console table:create

The command reads partition and sort key types from PHP property types (string maps to S, int/float to N). Billing mode defaults to PAY_PER_REQUEST (on-demand) and can be overridden globally via default_billing_mode or per table via the tables config. See ProvisionedThroughput for details on provisioned capacity.

Profiler

When the Symfony profiler is installed (symfony/web-profiler-bundle), the bundle adds a DynamoDB panel to the toolbar showing:

  • Operations — every DynamoDB API call with operation name, table, and execution time
  • Identity map — hit/miss counts showing how many find() calls were served from cache
  • Hydrations — how many entities were hydrated from DynamoDB responses

The profiler hooks into the AWS SDK middleware stack and the OGM's ProfilingLogger interface. It is registered only when the profiler service is available — zero overhead in production.

Requirements

  • PHP >= 8.5
  • likeuntomurphy/serverless-ogm ^0.1
  • symfony/framework-bundle ^8.0

License

MIT

likeuntomurphy/serverless-ogm-bundle 适用场景与选型建议

likeuntomurphy/serverless-ogm-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 12 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 04 月 06 日, 在 PHP 生态内属于活跃度较高的组件。

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

围绕 likeuntomurphy/serverless-ogm-bundle 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-04-06