Subscribable Notifications

Subscribable Notifications

Subscribable Notifications is a Laravel package by Peter Fox for adding unsubscribe links to notifications:

This package is designed to help you handle email unsubscribes with as little as 5 minutes setup. After installing your notifications sent over email should now be delivered with unsubscribe links in the footer and as a mail header which email clients can present to the user for quicker unsubscribing. It can also handle resolving the unsubscribing of the user through a signed route/controller.

This package works by implementing the CanUnsubscribe interface on the User model, along with an optional trait that fulfills the interface on your model. You can also write a custom implementation using the interface, for example:

public function unsubscribeLink(?string $mailingList = ''): string
{
    return URL::signedRoute(
        'sorry-to-see-you-go,
        ['subscriber' => $this, 'mailingList' => $mailingList],
        now()->addDays(1);
    );
}

You can also apply specific mailing lists to notifications using the AppliesToMailingList trait on the notifications on which you wish to support this feature. Using this feature provides two links at the bottom of email notifications: one for unsubscribing from all emails and another for only unsubscribing from a specific type of notification.

This package provides a lot of customization options both in the logic of unsubscribing as well as the templates. You can learn more about this package, get full installation instructions, and view the source code on GitHub at ylsideas/subscribable-notifications.


Filed in: News


Newsletter

Join the weekly newsletter and never miss out on new tips, tutorials, and more.

Laravel News Partners

Laravel Jobs

Full Stack or Back-End Developer
Alexandria, VA; Tallahassee, FL; Orlando, FL
Marketing for Change
Full Stack Software Engineer
Atlanta, GA or Remote
Voxie
Laravel/PHP Developer
Chicago, IL
Neon One
Software Engineer, Web Applications
Vaughan, ON, Canada
Blast Motion
Contract Services Software Engineer (Laravel | Vue | Tailwind)
Remote
Riverbed Technology
Senior Laravel Developer
Wilmington, NC
GE Software Inc.
Senior Full Stack Developer (PHP | Vue | DDD)
Charleston, SC
MassageBook