NewWe open-sourced 50+ Laravel packages
Custom AI apps, agents and automation — Roundly ConsultingRoundly
All packages

Each lifecycle transition dispatches an event from RoundlyConsulting\Posts\Events carrying the post’s id as public readonly int|string $postId:

EventDispatched by
PostPublishedpublish(), create() of a Published post, and publishDue() / posts:publish-scheduled
PostScheduledschedule(), and create() of a Scheduled post
PostArchivedarchive() — also the moderation listener
PostDraftedunpublish() — also the moderation listener
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Event;
use RoundlyConsulting\Posts\Events\PostPublished;

Event::listen(PostPublished::class, fn (PostPublished $e) => Cache::forget("post:{$e->postId}"));

Events fire only when the status actually changes — every schedule() fires PostScheduled, since it always moves the date — so a repeated call or a racing publishDue() run never fires one twice.

The package itself listens to PostPublished (to warm media variants) and to reports’ ReportResolved and ReportThresholdReached (to auto-unpublish). Creating a post as Published or Scheduled fires PostPublished or PostScheduled as well.

Show your open-source love

This package is free and MIT-licensed. If it saves you time, a one-off donation or a Patreon membership keeps it maintained, tested and documented.

More ways to support, including crypto

By donating, you agree to our donation terms.

Want this built into your product?

We integrate our packages into custom Laravel and AI builds. Tell us what you're working on and we'll reply within 48 hours.