Skip to content

Events

tilttek/reading-quests-bundle

ReadingTracker hands the events of phil/reading-progress to the application's event dispatcher, after the reading is stored:

EventWhen
Phil\ReadingProgress\ReadingStartedThe first position of a reading.
Phil\ReadingProgress\ReadingCompletedThe position that finishes it, past the completion percent.

Each carries the document's identifier, the reader's and the time, never the text. A position stored after a conflict retried dispatches its events once; a position that meets a conflict dispatches nothing.

use Phil\ReadingProgress\ReadingCompleted;
use Symfony\Component\EventDispatcher\Attribute\AsEventListener;

#[AsEventListener]
final readonly class CongratulateTheReader
{
    public function __invoke(ReadingCompleted $event): void
    {
        // A badge, a notification, a celebration on the next page.
    }
}

The activities in the journal are told by tilttek/activity-bundle to its own observers and projections: a quest of tilttek/quests-bundle follows them there, not through these events.

Without an event dispatcher in the container, nothing is dispatched and the rest goes on.