定制 prooph/pdo-event-store 二次开发

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

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

prooph/pdo-event-store

Composer 安装命令:

composer require prooph/pdo-event-store

包简介

Prooph PDO EventStore

README 文档

README

Build Status Coverage Status Gitter

PDO EventStore implementation for Prooph EventStore

Requirements

  • PHP >= 7.3
  • PDO_MySQL Extension or PDO_PGSQL Extension

For MariaDB you need server version >= 10.2.11.
Performance Impact: see [MariaDB Indexes and Efficiency](docs/variants.md#MariaDB Indexes and Efficiency)

For MySQL you need server version >= 5.7.9.

For Postgres you need server version >= 9.4.

Attention: Since v1.6.0 MariaDB Server has to be at least 10.2.11 due to a bugfix in MariaDB, see https://jira.mariadb.org/browse/MDEV-14402.

Setup

For MariaDB run the script in scripts/mariadb/01_event_streams_table.sql on your server.

For MySQL run the script in scripts/mysql/01_event_streams_table.sql on your server.

For Postgres run the script in scripts/postgres/01_event_streams_table.sql on your server.

This will setup the required event streams table.

If you want to use the projections, run additionally the scripts scripts/mariadb/02_projections_table.sql (for MariaDB), scripts/mysql/02_projections_table.sql (for MySQL) or scripts/postgres/02_projections_table.sql (for Postgres) on your server.

Upgrade from 1.6 to 1.7

Starting from v1.7 the pdo-event-store uses optimized table schemas. The upgrade can be done in background with a script optimizing that process. A downtime for the database should not be needed. In order to upgrade your existing database, you have to execute:

  • MariaDB
ALTER TABLE `event_streams` MODIFY `metadata` LONGTEXT NOT NULL;
ALTER TABLE `projections` MODIFY `position` LONGTEXT;
ALTER TABLE `projections` MODIFY `state` LONGTEXT;

Then for all event-streams (SELECT stream_name FROM event_streams)

ALTER TABLE <stream_name> MODIFY `payload` LONGTEXT NOT NULL;
ALTER TABLE <stream_name> MODIFY `metadata` LONGTEXT NOT NULL,
  • MySQL

nothing to upgrade

  • Postgres

For all event-streams (SELECT stream_name FROM event_streams)

ALTER TABLE <stream_name> MODIFY event_id UUID NOT NULL;

Additional note:

When using Postgres, the event_id has to be a valid uuid, so be careful when using a custom MetadataMatcher, as the event-store could throw an exception when passing a non-valid uuid (f.e. "foo") as uuid.

The migration is strongly recommended, but not required. It's fully backward-compatible. The change on Postgres is only a microoptimization, the change on MariaDB prevents errors, when the stored json gets too big.

Introduction

Prooph Event Store v7

Tests

If you want to run the unit tests locally you need a runnging MySql server listening on port 3306 and a running Postgres server listening on port 5432. Both should contain an empty database event_store_tests.

Run Tests With Composer

MariaDb

$ vendor/bin/phpunit -c phpunit.xml.mariadb

MySql

$ vendor/bin/phpunit -c phpunit.xml.mysql

Postgres

$ vendor/bin/phpunit -c phpunit.xml.postgres

Run Tests With Docker Compose

MariaDb

docker-compose -f docker-compose-tests.yml run tests composer run-script test-mariadb --timeout 0; \
docker-compose -f docker-compose-tests.yml stop

MySql

docker-compose -f docker-compose-tests.yml run tests composer run-script test-mysql --timeout 0; \
docker-compose -f docker-compose-tests.yml stop

Postgres

docker-compose -f docker-compose-tests.yml run tests composer run-script test-postgres --timeout 0; \
docker-compose -f docker-compose-tests.yml stop

Support

Contribute

Please feel free to fork and extend existing or add new plugins and send a pull request with your changes! To establish a consistent code quality, please provide unit tests for all your changes and may adapt the documentation.

License

Released under the New BSD License.

prooph/pdo-event-store 适用场景与选型建议

prooph/pdo-event-store 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.22M 次下载、GitHub Stars 达 112, 最近一次更新时间为 2016 年 11 月 10 日, 在 PHP 生态内属于活跃度较高的组件。

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

围绕 prooph/pdo-event-store 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

  • 总下载量: 1.22M
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 112
  • 点击次数: 24
  • 依赖项目数: 22
  • 推荐数: 6

GitHub 信息

  • Stars: 112
  • Watchers: 11
  • Forks: 60
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2016-11-10