承接 likeuntomurphy/serverless-ogm-bundle 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

likeuntomurphy/serverless-ogm-bundle

最新稳定版本:v0.1.0-alpha2

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

统计信息

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

GitHub 信息

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

其他信息

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

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固