phariscope/event-store-doctrine

Store event via Doctrine

1.1.2 2024-03-12 08:08 UTC

This package is auto-updated.

Last update: 2024-04-12 08:20:58 UTC


README

composer require phariscope/event-store

Usage

  1. First, make sure to have the DATABASE_URL environment variable correctly initialized.
  2. Second, add the PersistEventSubscriber to the listeners as soon as you want.

Enjoy, and observe an 'events' table that contains all published 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

To Contribut to pharsicope/EventStoreDoctrine

Requirements

  • docker
  • git

Install

Unit test

bin/phpunit

Using Test-Driven Development (TDD) principles (thanks to Kent Beck and others), following good practices (thanks to Uncle Bob and others) and the great book 'DDD in PHP' by C. Buenosvinos, C. Soronellas, K. Akbary

Quality

  • phpcs PSR12
  • phpstan level 9
  • coverage 100%
  • infection MSI 100%

Quick check with:

./codecheck

Check coverage with:

bin/phpunit --coverage-html var

and view 'var/index.html' with your browser

Check infection with:

bin/infection

and view 'var/infection.html' with your browser