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

The facade is the recommended default, not the only way in. Every operation is an action, the manager exposes each one and the facade is sugar over the manager — all three run the same code. The manager is RoundlyConsulting\Notifications\NotificationsManager, the facade’s root, bound as a container singleton:

use RoundlyConsulting\Notifications\Actions\Sending\SendNotificationAction;
use RoundlyConsulting\Notifications\DataTransferObjects\SendNotificationData;
use RoundlyConsulting\Notifications\Facades\Notifications;
use RoundlyConsulting\Notifications\NotificationsManager;
use RoundlyConsulting\Notifications\Recipients;

// 1. Facade
Notifications::send('request.awaiting_approval', $request, $approvers, ['reference' => $request->reference]);

// 2. Dependency injection — the same API, no facade
app(NotificationsManager::class)->send('request.awaiting_approval', $request, $approvers);

// 3. The raw action
app(SendNotificationAction::class)->execute(new SendNotificationData(
    type: 'request.awaiting_approval',
    subject: $request,
    recipients: Recipients::users(...$approvers),
));

Inject the manager

use Illuminate\Http\RedirectResponse;
use RoundlyConsulting\Notifications\NotificationsManager;
use RoundlyConsulting\Notifications\Recipients;

final class SubmitPurchaseRequestController
{
    public function __construct(private NotificationsManager $notifications) {}

    public function __invoke(PurchaseRequest $request): RedirectResponse
    {
        $request->submit();

        $this->notifications->type('request.awaiting_approval')
            ->about($request)
            ->to(Recipients::role($request->company, 'approver'))
            ->by($request->author)
            ->once("request-submitted:{$request->id}")
            ->send();

        return to_route('requests.show', $request);
    }
}

The manager takes no constructor arguments and keeps no container: every call resolves its action from the current one, so it is safe as an Octane singleton and a per-request binding applies even when a provider used the facade during boot. It is not final on purpose — the fake extends it, so code that injects NotificationsManager still type-checks under Notifications::fake().

Call an action

use RoundlyConsulting\Notifications\Actions\Inbox\MarkInboxItemReadAction;
use RoundlyConsulting\Notifications\Actions\Preferences\UpdatePreferencesAction;
use RoundlyConsulting\Notifications\Actions\Reminders\AcknowledgeAction;

// Notifications::inbox($user)->markRead($item)  ≡
app(MarkInboxItemReadAction::class)->execute($user, $item);

// Notifications::preferences($user)->update($update)  ≡
app(UpdatePreferencesAction::class)->execute($user, $update);

// Notifications::for($contract)->acknowledge('contract.expiring', by: $user)  ≡
app(AcknowledgeAction::class)->execute($contract, 'contract.expiring', $user);

Facade method → action

Namespaces are relative to RoundlyConsulting\Notifications\Actions:

Actionexecute(…)ReturnsFacade path
Sending\SendNotificationActionexecute(SendNotificationData)SendResultsend() · sendNotification() · type()->send() · for()->send()
Inbox\MarkInboxItemReadActionexecute($recipient, $item)InboxIteminbox()->markRead()
Inbox\MarkInboxItemUnreadActionexecute($recipient, $item)InboxIteminbox()->markUnread()
Inbox\MarkAllInboxItemsReadActionexecute($recipient, $in, $category, $type, $withoutContext, $since)intinbox()->markAllRead()
Inbox\ArchiveInboxItemAction · UnarchiveInboxItemActionexecute($recipient, $item)InboxIteminbox()->archive() · unarchive()
Inbox\DeleteInboxItemActionexecute($recipient, $item)voidinbox()->delete() · DELETE /inbox/{item}
Inbox\RevokeNotificationsActionexecute($subject, ?$recipient)intfor()->revoke()
Inbox\RecordInboxMessageActionexecute($recipient, InboxMessage)?InboxIteminboxMessage() · the inbox channel
Preferences\SetChannelPreferenceActionexecute($user, $type, list<Channel>, ?bool)voidpreferences()->mute() · unmute() · set()
Preferences\SetCategoryPreferenceActionexecute($user, $category, list<Channel>, ?bool)voidpreferences()->muteCategory() · unmuteCategory()
Preferences\ResetPreferencesActionexecute($user)voidpreferences()->reset()
Preferences\SetDigestPreferenceActionexecute($user, DigestPreferenceData)voidpreferences()->digest()
Preferences\SetQuietHoursActionexecute($user, ?QuietHours)voidpreferences()->quietHours()
Preferences\SetNotificationTimezoneActionexecute($user, ?string)voidpreferences()->timezone()
Preferences\UpdatePreferencesActionexecute($user, PreferencesUpdate)voidpreferences()->update() · PATCH /preferences
Preferences\RedeemUnsubscribeActionexecute(string $token)UnsubscribeResultunsubscribe()->redeem() · POST /unsubscribe/{token}
Delivery\DispatchDueDeliveriesActionexecute()intdeliveries()->dispatchDue()
Digests\SendDueDigestsAction · PreviewDigestActionexecute() · execute($user)int · ?MailMessagedigests()->sendDue() · preview()
Reminders\SyncRemindersActionexecute($subject, ?$type)intfor()->reminders()->sync()
Reminders\ScheduleRemindersActionexecute($subject, $type, RecipientSpec, bool $restart = false)list<NotificationReminder>for()->reminders()->schedule()
Reminders\RemindActionexecute($subject, $type, ReminderRule, RecipientSpec, $data)list<NotificationReminder>for()->remind()
Reminders\CancelRemindersActionexecute($subject, ?$type, CancelReason, ?Model $for)intfor()->reminders()->cancel()
Reminders\SnoozeRemindersActionexecute($subject, $type, Model $recipient, CarbonInterface $until)intfor()->reminders()->snooze()
Reminders\AcknowledgeActionexecute($subject, ?$type, ?$by)intfor()->acknowledge() · reminders()->acknowledge()
Reminders\FireDueRemindersAction · BackfillRemindersActionexecute() · execute($type)FiredReminders · intreminders()->fireDue() · backfill()
Maintenance\SweepAction · PruneNotificationsActionexecute(?$only) · execute()SweepReport · PruneReportsweep() · prune()
  • Every mutating call — from the facade, an injected manager, a handle, the fluent builder, a model trait or the inbox channel — funnels through the manager, which resolves the action from the container, so a container binding of an action applies everywhere.
  • Notifications::fake() swaps the manager in the container too, so an injected NotificationsManager is faked as well. Calling an action directly is not recorded.
  • Internal building blocks — ResolveRecipientsAction, DeliverToRecipientAction, RecordInboxItemAction, QueueMailDeliveryAction, RecomputeDeferredDeliveriesAction, DeliverMailAction, ExpireStaleClaimsAction, SendDigestAction, FireReminderAction, FireEscalationAction, ApplyInteropRulesAction, ReleaseHeldInteropMailAction and ForgetSubjectInboxAction (the subject-deleted cleanup) — are not for app code.

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.