定制 eventsauce/message-repository-for-doctrine 二次开发

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

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

eventsauce/message-repository-for-doctrine

最新稳定版本:1.4.0

Composer 安装命令:

composer require eventsauce/message-repository-for-doctrine

包简介

Message Repository for Doctrine DBAL 3

README 文档

README

MessageRepository implementation that uses Doctrine DBAL for event persistence.

Usage

use EventSauce\MessageRepository\DoctrineMessageRepository\DoctrineUuidV4MessageRepository;
use EventSauce\MessageRepository\TableSchema\DefaultTableSchema;
use EventSauce\UuidEncoding\BinaryUuidEncoder;

$messageRepository = new DoctrineUuidV4MessageRepository(
    connection: $doctrineDbalConnection,
    tableName: $tableName,
    serializer: $eventSauceMessageSerializer,
    tableSchema: new DefaultTableSchema(), // optional
    uuidEncoder: new BinaryUuidEncoder(), // optional
);

Table Schema

TableSchema allows customizing the table and column names used when performing database operations, as well as allowing for additional headers to be added.

Default Table Schema

The default implementation DefaultTableSchema uses the following column names:

  • event_id primary key (text/UUID)
  • aggregate_root_id aggregate root ID (text/UUID)
  • version aggregate root version (int)
  • payload encoded event payload (text/JSON)

Legacy Table Schema

For users upgrading from EventSauce pre-1.0, there is a LegacyTableSchema:

  • event_id primary key (text/UUID)
  • event_type the serialized event name (text)
  • aggregate_root_id aggregate root ID (text/UUID)
  • aggregate_root_version aggregate root version (int)
  • time_of_recording when the event was written (timestamp)
  • payload encoded event payload (text/JSON)

Custom Implementations

Custom implementations of TableSchema can use the additionalColumns method to write other Header values to columns, which can be useful for indexing.

UUID Encoder

UuidEncoder allows customizing how the UUIDs used for the event ID and the aggregate root ID are converted to string when written to the database.

Binary UUID Encoder

UuidBinaryEncoder encodes the UUID using $uuid->getBytes() to generate a binary text version of the UUID, which should be used when the database does not have a native uuid type.

String UUID Encoder

UuidStringEncoder encodes the UUID using $uuid->toString() to generate a plain text version of the UUID, which should be used when the database has a uuid type.

Custom Implementations

Custom implementations of UuidEncoder can be used to optimize UUID storage as needed.

统计信息

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

GitHub 信息

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

其他信息

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

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固