Open source
Notifications for Laravel
composer require roundly-consulting/notifications-for-laravelOverview
Typed notifications for Laravel apps with an in-app inbox and email. Register each kind of notification once, send it from any feature through one call, and the package decides per recipient: may they still see the record, do they want it and on which channel, is it the same thing they heard a minute ago, is it the middle of their night, should it wait for their digest. Reminders follow a date and escalate when nobody acknowledges, and other packages’ notifications can run through the same rules. MIT-licensed and built on Laravel’s own notification system plus Roundly’s crypto, enums, options and package-toolkit — no third-party notification service.
What you get
Typed notification types
Describe each kind of notification once — a small class or a fluent define() — with its category, channels, priority, window, subject and rendering hooks.
An inbox that never piles up
Ten events on one subject inside the window become one item that says 10 and shows the latest actor — filterable by context, with unread counts per workspace.
Preferences people control
Per type, category and channel, stored per user. Mandatory types cannot be muted, and a whole settings screen saves all or nothing.
Email that respects people
Leading or trailing de-dup, quiet hours in each user’s timezone, daily or weekly digests, discreet mail for sensitive subjects and at-most-once delivery.
Reminders that follow the calendar
60, 30 and 7 days before a date — moved when the date moves, re-armed on renewal, stopped on delete, escalated when nobody acknowledges.
Access re-checked at every hop
Your own policies are asked at the send, in the queue, after quiet hours, in the digest and on every reminder — someone who lost access gets nothing.
Facade, DI or actions
One Notifications facade, an injectable manager or single-purpose actions — plus a record-only fake, Pest expectations and an opt-in JSON API.
Documentation
Use cases
Where the package fits — SaaS approvals, contract renewals, multi-workspace inboxes, security notices and other packages’ notifications.
Installation
Install via Composer, publish both migration sets, schedule notifications:sweep every minute, set key types and make your User a recipient.
Configuration
Every key of config/notifications.php with its env variable and default — key types, tables, queue, inbox, mail, quiet hours, digests, routes, pruning.
Notification types
Register each kind of notification once — a NotificationType class or a fluent define() — with every hook, its default and the payload.
Recipient and subject models
ReceivesNotifications, HasNotificationReminders and the contracts that name a timezone, a group’s members, an owner or a context label.
The Notifications facade
Tour the Notifications facade — send, type(), for($subject), inbox(), preferences(), define(), the accessors, sweep and prune — with every method.
DI and actions
Skip the facade: inject NotificationsManager or call a single-purpose action — every host-facing action with its execute() signature and facade path.
Sending
send(), the fluent type()->…->send(), for($subject), contexts, once() idempotency, escalate(), fan-out, transactions and the SendResult.
Recipients and access
Recipients::users, role, members, owner, using and merge, the group resolver and teams recipe, fail-closed access checks and revoke().
Inbox
Collapsing within a window, contexts, immutable queries and counts, read/archive/delete, resources without class names, broadcasting and the inbox channel.
Preferences
Per-user channel, category and type preferences, mandatory types, the settings matrix, all-or-nothing update(), storage through options and locking.
Leading and trailing de-dup within the window, the life of a delivery, at-most-once sending, rendering, minimal mail and the address resolver.
Quiet hours and timezones
Hold non-urgent mail during each user’s local quiet hours, resolve the timezone, handle DST, and set a default for users without their own.
Digests
Collect low-priority notifications into one daily or weekly email at a local time — slots, periods, runs, frequency changes, failures and preview.
Reminders and escalation
Reminder::before/after/at, while(), rearm(), acknowledgedOnRead(), the HasNotificationReminders trait, ad-hoc reminders, firing and escalation chains.
Other packages’ notifications
Map other packages’ notification classes to your types so preferences, de-dup, quiet hours and the inbox apply — or suppress them — with fail-open safety.
JSON API
The opt-in JSON API — all 11 routes for the authenticated user’s inbox, preferences and types, with filters, bodies, errors and resources.
Events
Every event the package dispatches after the commit — inbox, mail, digest, reminder, escalation, preference, skip and interop failures.
Exceptions
Every domain exception with its stable code and HTTP status, the configuration exceptions, and how to map them in your own API.
Artisan commands
notifications:sweep, prune, types, doctor, install and reminders:sync — what each does, the doctor’s checks and the facade equivalents.
Testing
Notifications::fake() records without running — every assertion, recorded operations, passthrough(), Pest expectations, the real pipeline and factories.
Requirements
PHP 8.4+, Laravel 13, MySQL or PostgreSQL (SQLite for tests), a queue worker, the scheduler and four Roundly packages.
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 cryptoBy 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.