phariscope/event-store-doctrine

通过 Doctrine 存储事件

1.1.2 2024-03-12 08:08 UTC

This package is auto-updated.

Last update: 2024-09-12 09:08:28 UTC


README

composer require phariscope/event-store

使用方法

  1. 首先,请确保正确初始化了 DATABASE_URL 环境变量。
  2. 其次,在需要时尽快将 PersistEventSubscriber 添加到监听器中。

享受使用,并观察包含所有已发布事件的 'events' 表。

    // Assume env var is intiailized.
    // Example DATABASE_URL=mysql://root:pwd1234@mariadb:3306/ap-prod?serverVersion=mariadb-10.9.3&charset=utf8mb4

    $store = new EventStoreDoctrine();
    $subscriber = new PersistDoctrineEventSubscriber($store);
    EventPublisher::instance()->subscribe($subscriber); // use your own EventPublisherFacade could be a good idea

为 phariscope/EventStoreDoctrine 贡献

要求

  • docker
  • git

安装

单元测试

bin/phpunit

遵循测试驱动开发 (TDD) 原则(感谢 Kent Beck 和其他人),遵循良好的实践(感谢 Uncle Bob 和其他人),以及 C. Buenosvinos,C. Soronellas,K. Akbary 所著的《PHP中的DDD》一书

质量

  • phpcs PSR12
  • phpstan 级别 9
  • 覆盖率 100%
  • infection MSI 100%

快速检查

./codecheck

使用以下命令检查覆盖率

bin/phpunit --coverage-html var

并使用您的浏览器查看 'var/index.html'

使用以下命令检查 infection

bin/infection

并使用您的浏览器查看 'var/infection.html'