phariscope/event

To implement events in domain driven developement or anyother styles projects with PHP

1.1.0 2024-02-29 22:34 UTC

This package is auto-updated.

Last update: 2024-04-29 23:50:03 UTC


README

composer require phariscope/event

Usage

Steps are:

  • Create a domain event (name + past tense verb, example: AccountCreated extends EventAbstract).
  • Publish this event.
  • Distribute events.

Somewhere else:

  • create a subscriber at an event (exemple: class SendEmailWhenAccountCreatedSubscriber implements EventSubscriber)
  • register the subscriber, when event will be distrute the subscriber will handle it and do what it has to do

To Contribut to pharsicope/Event

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 >99%

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