Events
tilttek/reading-quests-bundleReadingTracker hands the events of phil/reading-progress to the application's event dispatcher, after the reading
is stored:
| Event | When |
|---|---|
Phil\ReadingProgress\ReadingStarted | The first position of a reading. |
Phil\ReadingProgress\ReadingCompleted | The 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.