Skip to content

Replay page

Enable replayPage() on the plugin to add a page that replays projectors one at a time. It is off by default and gated three ways: the plugin option, the replay.enabled config flag and an optional authorization ability. All three are checked again on the server before a replay runs.

The page lists the registered projectors and offers a confirmation-guarded Replay action for each. When a replay finishes, a notification reports how many events were replayed.

The replay confirmation modal

The replay result notification

Projectors must be replay-safe

Spatie’s replay does not wipe your read model. A full replay calls resetState() on each projector only if that method exists. A projector that simply inserts in its creation handler will hit a unique constraint on replay because the existing rows are still there.

Make projectors behind Filament managed resources replay-safe, either by implementing resetState() to clear their projection, or by making their handlers idempotent (for example with updateOrCreate). This package does not reset projections for you.

use Spatie\EventSourcing\EventHandlers\Projectors\Projector;
class PostProjector extends Projector
{
public function resetState(): void
{
Post::query()->delete();
}
// event handlers...
}

See the Configuration reference for the replay.enabled and replay.authorize options.