PHPackages                             rubik-llc/laravel-notification-manager - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Mail &amp; Notifications](/categories/mail)
4. /
5. rubik-llc/laravel-notification-manager

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

rubik-llc/laravel-notification-manager
======================================

Manage notifications easily in your Laravel app.

v0.1.0(4y ago)13274[3 PRs](https://github.com/rubik-llc/laravel-notification-manager/pulls)MITPHPPHP ^8.1

Since Mar 17Pushed 2y ago2 watchersCompare

[ Source](https://github.com/rubik-llc/laravel-notification-manager)[ Packagist](https://packagist.org/packages/rubik-llc/laravel-notification-manager)[ Docs](https://github.com/rubik-llc/laravel-notification-manager)[ GitHub Sponsors](https://github.com/rubik-llc)[ RSS](/packages/rubik-llc-laravel-notification-manager/feed)WikiDiscussions main Synced 3d ago

READMEChangelog (1)Dependencies (13)Versions (5)Used By (0)

Laravel notification manager
============================

[](#laravel-notification-manager)

[![Platform](https://camo.githubusercontent.com/69c09f29de04e9813d7b160a87878f515b9ba71c4e2d47212f8eb91e59c65604/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f706c6174666f726d2d6c61726176656c2d726564)](https://camo.githubusercontent.com/69c09f29de04e9813d7b160a87878f515b9ba71c4e2d47212f8eb91e59c65604/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f706c6174666f726d2d6c61726176656c2d726564)[![Latest Version on Packagist](https://camo.githubusercontent.com/c510480ed1b6d5e17d377b375d24b68940e0ad314b6322ec23b963cb96508758/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f727562696b2d6c6c632f6c61726176656c2d6e6f74696669636174696f6e2d6d616e616765722e737667)](https://packagist.org/packages/rubik-llc/laravel-notification-manager)[![GitHub Workflow Status](https://camo.githubusercontent.com/fe1a2108e237d375a3f1128bc1ed1ccdc7116fe3b38e72a78acfbd429ab0742f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f727562696b2d6c6c632f6c61726176656c2d6e6f74696669636174696f6e2d6d616e616765722f72756e2d74657374733f6c6162656c3d7465737473)](https://github.com/rubik-llc/laravel-notification-manager/actions/workflows/run-tests.yml)[![Check & fix styling](https://camo.githubusercontent.com/6dd36278f1df810cf07e9d81466349b2d4628b14325d9ba064e3b4fb20d0defc/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f727562696b2d6c6c632f6c61726176656c2d6e6f74696669636174696f6e2d6d616e616765722f436865636b253230262532306669782532307374796c696e673f6c6162656c3d636865636b253230616e642532306669782532307374796c696e67)](https://github.com/rubik-llc/laravel-notification-manager/actions/workflows/php-cs-fixer.yml)[![GitHub](https://camo.githubusercontent.com/50a1b730a3d89ea39c35cbe4574724f4bf7b7c6f184e77fce3fdfca8766b0262/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f727562696b2d6c6c632f6c61726176656c2d6e6f74696669636174696f6e2d6d616e61676572)](LICENSE.md)[![GitHub all releases](https://camo.githubusercontent.com/2b5382738c3c4e26f27dce76d1d051836c58fc0c022561abeaf803ae5dd39f84/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f727562696b2d6c6c632f6c61726176656c2d6e6f74696669636174696f6e2d6d616e61676572)](https://packagist.org/packages/rubik-llc/laravel-notification-manager/stats)

In addition to Laravel’s default notifications, this package adds further attributes like `seen_at`, `is_prioritised`, `is_muted`, `preview_type` and `alert_type`. These attributes can be used to classify notifications for a better user experience. Furthermore, using this package you can manage subscriptions to certain notifications based on user preference, meaning that a user can specify whether or not to receive a certain notification type, channel or even a specific notification.

Features
--------

[](#features)

- Manage subscribers
- Manage notification priorities
- Manage muted notifications (mute, unmute)
- Classifies notifications according to the way they appear
- Classifies notifications according where they appear
- Mark as seen

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require rubik-llc/laravel-notification-manager
```

You can publish and run the migrations with:

```
php artisan vendor:publish --tag="notification-manager-migrations"
php artisan migrate
```

You can publish the config file with:

```
php artisan vendor:publish --tag="notification-manager-config"
```

This is the contents of the published config file:

```
return [

    /*
    |--------------------------------------------------------------------------
    | Subscribable notifications
    |--------------------------------------------------------------------------
    |
    | All notifications which we would like to be subscribable must be placed here.
    | If artisan command is used to create subscribable notification this will be autofilled
    |
    | Example:
    |   'subscribable_notifications' => [
    |       'order.accepted' => Rubik\NotificationManager\Tests\TestSupport\Notifications\OrderApprovedSubscribableNotification,
    |       'order.rejected' => Rubik\NotificationManager\Tests\TestSupport\Notifications\OrderRejectedSubscribableNotification,
    |   ],
    */

    'subscribable_notifications' => [

    ],

    /*
    |--------------------------------------------------------------------------
    | Channels
    |--------------------------------------------------------------------------
    |
    | All available channels must be placed here
    | A notification will be sent to all these channels if model is subscribed to all channel("*").
    | Example
    | 'channels' => "database,broadcast",
    |
    */

    'channels' => "",

];
```

Usage
-----

[](#usage)

1. Use our “Notifiable” trait in all models you wish to send notifications(most cases Users)
    - This can be done by changing the import from “use Illuminate\\Notifications\\Notifiable;” to “use Rubik\\NotificationManager\\Traits\\Notifiable;”, and also if not yet use the trait “use Notifiable”;. Your model should look like
2. Use HasNotificationSubscription trait in all models you wish to send notifications
3. Create subscribale notification by using “-s” flag in the default artisan command to create a notification.
4. Add this notification to config file

```
php artisan make:notification SubscribaleNotification -s
```

From now on everything is the same as a normal notification. Below you can see how your Model and Notification should look like:

```
namespace App\Notifications;

use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
use Rubik\NotificationManager\Contracts\SubscribableNotificationContract;
use Rubik\NotificationManager\Traits\SubscribableNotification;

class TestNotification extends Notification implements SubscribableNotificationContract
{
    use Queueable, SubscribableNotification;

    /**
     * Create a new notification instance.
     *
     * @return void
     */
    public function __construct()
    {
        //
    }

    /**
     * Get the mail representation of the notification.
     *
     * @param  mixed  $notifiable
     * @return \Illuminate\Notifications\Messages\MailMessage
     */
    public function toMail($notifiable)
    {
        return (new MailMessage)
                    ->line('The introduction to the notification.')
                    ->action('Notification Action', url('/'))
                    ->line('Thank you for using our application!');
    }

    /**
     * Subscribable type based on the name in config file
     *
     * @return string
     */
    public static function subscribableNotificationType(): string
    {
        return 'test';
    }

    /**
     * Get the array representation of the notification.
     *
     * @param  mixed  $notifiable
     * @return array
     */
    public function toArray($notifiable)
    {
        return [
            //
        ];
    }
}
```

If you want to convert a notification to a subscribable notification all you have to do is add SubscribaleNotification Contract and implement all methods required, and use SubscribaleNotification trait. Do not forget to add this notifion to your config. Your notification should look like:

```
namespace App\Notifications;

use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
use Rubik\NotificationManager\Contracts\SubscribableNotificationContract;
use Rubik\NotificationManager\Traits\SubscribableNotification;

class TestNotification extends Notification implements SubscribableNotificationContract
{
    use Queueable, SubscribableNotification;

    //Your code here

    /**
     * Subscribable type based on the name in config file
     *
     * @return string
     */
    public static function subscribableNotificationType(): string
    {
        return 'test';
    }
}
```

All changes will affect only future notifications, and if not specified different changes will affect the desired notification of the authenticated user. Will be explained below.

Subscribers/Unsubscribe
-----------------------

[](#subscribersunsubscribe)

### Subscribe to a notification:

[](#subscribe-to-a-notification)

```
NotificationManager::subscribe(OrderApprovedSubscribableNotification::class);
```

or:

```
OrderApprovedSubscribableNotification::subscribe();
```

### Unsubscribe to a notification:

[](#unsubscribe-to-a-notification)

```
NotificationManager::unsubscribe(OrderApprovedSubscribableNotification::class);
```

or:

```
OrderApprovedSubscribableNotification::unsubscribe();
```

### Subscribe a user to a notification:

[](#subscribe-a-user-to-a-notification)

```
NotificationManager::for(User::find(1))->subscribe(OrderApprovedSubscribableNotification::class);
```

### Unsubscribe a user to a notification:

[](#unsubscribe-a-user-to-a-notification)

```
NotificationManager::for(User::find(1))->unsubscribe(OrderApprovedSubscribableNotification::class);
```

### Subscribe to all notifications:

[](#subscribe-to-all-notifications)

```
NotificationManager::subscribeAll();
```

### Unsubscribe to all notifications:

[](#unsubscribe-to-all-notifications)

```
NotificationManager::unsubscribeAll();
```

### Subscribe a user to all notifications:

[](#subscribe-a-user-to-all-notifications)

```
NotificationManager::for(User::find(1))->subscribeAll();
```

### Unsubscribe a user to all notifications:

[](#unsubscribe-a-user-to-all-notifications)

```
NotificationManager::for(User::find(1))->unsubscribeAll();
```

### Send notification to all subscribers:

[](#send-notification-to-all-subscribers)

Instead of using:

```
Notification::send(User::subscribers()->get(),new OrderApprovedSubscribableNotification($payload));
```

Use:

```
OrderApprovedSubscribableNotification::sendToSubscribers($payload)
```

Everything passed to send to subscriber will be passed to notification constructor.

Priority
--------

[](#priority)

### Set priority to a notification:

[](#set-priority-to-a-notification)

```
NotificationManager::prioritize(OrderApprovedSubscribableNotification::class);
```

or:

```
OrderApprovedSubscribableNotification::prioritize();
```

### Unset priority to a notification:

[](#unset-priority-to-a-notification)

```
NotificationManager::trivialize(OrderApprovedSubscribableNotification::class);
```

or:

```
OrderApprovedSubscribableNotification::trivialize();
```

### Set priority to a notification as a user:

[](#set-priority-to-a-notification-as-a-user)

```
NotificationManager::for(User::find(1))->prioritize(OrderApprovedSubscribableNotification::class);
```

### Unset priority to a notification as a user:

[](#unset-priority-to-a-notification-as-a-user)

```
NotificationManager::for(User::find(1))->trivialize(OrderApprovedSubscribableNotification::class);
```

Mute
----

[](#mute)

### Mute a notification:

[](#mute-a-notification)

```
NotificationManager::mute(OrderApprovedSubscribableNotification::class);
```

or:

```
OrderApprovedSubscribableNotification::mute();
```

### Unmute a notification:

[](#unmute-a-notification)

```
NotificationManager::unmute(OrderApprovedSubscribableNotification::class);
```

or:

```
OrderApprovedSubscribableNotification::unmute();
```

### Mute a notification for a user:

[](#mute-a-notification-for-a-user)

```
NotificationManager::for(User::find(1))->mute(OrderApprovedSubscribableNotification::class);
```

### Unmute a notification for a user:

[](#unmute-a-notification-for-a-user)

```
NotificationManager::for(User::find(1))->unmute(OrderApprovedSubscribableNotification::class);
```

Alert type
----------

[](#alert-type)

### Set/update alert type:

[](#setupdate-alert-type)

```
NotificationManager::alertType(OrderApprovedSubscribableNotification::class, NotificationAlertType::BANNER);
```

or:

```
OrderApprovedSubscribableNotification::alertType(NotificationAlertType::BANNER);
```

### Available alert types:

[](#available-alert-types)

```
NotificationAlertType::NOTIFICATION_CENTER;
NotificationAlertType::BANNER;
NotificationAlertType::LOCK_SCREEN;
```

those are only values and in no way they represent a logic. You can use those values to classify notifications.

Preview type
------------

[](#preview-type)

### Set/update preview type:

[](#setupdate-preview-type)

```
NotificationManager::previewType(OrderApprovedSubscribableNotification::class, NotificationPreviewType::ALWAYS);
```

or:

```
OrderApprovedSubscribableNotification::previewType(NotificationPreviewType::ALWAYS);
```

### Available alert types:

[](#available-alert-types-1)

```
NotificationPreviewType::ALWAYS;
NotificationPreviewType::WHEN_UNLOCKED;
NotificationPreviewType::NEVER;
```

Seen
----

[](#seen)

### Mark as seen

[](#mark-as-seen)

```
User::find(1)->notifications()->markAsSeen();
```

or:

```
DatabaseNotification::all()->markAsSeen();
```

or:

```
$user=User::find(1);

$user->unseenNotifications()->update(['seen_at' => now()]);
```

or:

```
$user = App\Models\User::find(1);

foreach ($user->unseenNotifications as $notification) {
    $notification->markAsSeen();
}
```

### Mark as unseen

[](#mark-as-unseen)

```
User::find(1)->notifications()->markAsUnseen();
```

or:

```
DatabaseNotification::all()->markAsUnseen();
```

or:

```
$user->seenNotifications()->update(['seen_at' => null]);
```

or:

```
$user = App\Models\User::find(1);

foreach ($user->seenNotifications as $notification) {
    $notification->markAsUnseen();
}
```

### Get all seen notifications:

[](#get-all-seen-notifications)

```
User::find(1)->seenNotifications();
```

### Get all unseen notifications:

[](#get-all-unseen-notifications)

```
User::find(1)->unseenNotifications();
```

### Get all prioritized notifications:

[](#get-all-prioritized-notifications)

```
User::find(1)->prioritizedNotifications();
```

### Get all trivialized notifications:

[](#get-all-trivialized-notifications)

```
User::find(1)->trivializedNotifications();
```

### Get all muted notifications:

[](#get-all-muted-notifications)

```
User::find(1)->mutedNotifications();
```

### Get all unmuted notifications:

[](#get-all-unmuted-notifications)

```
User::find(1)->unmutedNotifications();
```

### Get all notifications with alert type set to 'notification-center':

[](#get-all-notifications-with-alert-type-set-to-notification-center)

```
User::find(1)->alertNotificationCenterNotifications();
```

### Get all notifications with alert type set to 'banner':

[](#get-all-notifications-with-alert-type-set-to-banner)

```
User::find(1)->alertBannerNotifications();
```

### Get all notifications with alert type set to 'lock-screen':

[](#get-all-notifications-with-alert-type-set-to-lock-screen)

```
User::find(1)->alertLockScreenNotifications();
```

### Get all notifications with preview type set to 'always':

[](#get-all-notifications-with-preview-type-set-to-always)

```
User::find(1)->previewAlwaysNotifications();
```

### Get all notifications with preview type set to 'when-unlocked':

[](#get-all-notifications-with-preview-type-set-to-when-unlocked)

```
User::find(1)->previewWhenUnlockedNotifications();
```

### Get all notifications with preview type set to 'never':

[](#get-all-notifications-with-preview-type-set-to-never)

```
User::find(1)->previewNeverNotifications();
```

### Check if a notification is seen:

[](#check-if-a-notification-is-seen)

```
User::find(1)->notifications()->first()->seen();
```

### Check if a notification is unseen:

[](#check-if-a-notification-is-unseen)

```
User::find(1)->notifications()->first()->unseen();
```

### Check if a notification is prioritised:

[](#check-if-a-notification-is-prioritised)

```
User::find(1)->notifications()->first()->seen();
```

### Check if a notification is trivialised:

[](#check-if-a-notification-is-trivialised)

```
User::find(1)->notifications()->first()->triavilized();
```

### Check if a notification is muted:

[](#check-if-a-notification-is-muted)

```
User::find(1)->notifications()->first()->muted();
```

### Check if a notification is unmuted:

[](#check-if-a-notification-is-unmuted)

```
User::find(1)->notifications()->first()->unmuted();
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Yllndrit Beka](https://github.com/yllndritb)
- [Rron Nela](https://github.com/rronik)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 62.2% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1517d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a7c1f9aba4ff97c724276769d2df23b56a640cc2548340763355e65190bbf758?d=identicon)[rubik.llc.dev](/maintainers/rubik.llc.dev)

---

Top Contributors

[![yllndritb](https://avatars.githubusercontent.com/u/17571462?v=4)](https://github.com/yllndritb "yllndritb (28 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (8 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (8 commits)")[![rronik](https://avatars.githubusercontent.com/u/35034872?v=4)](https://github.com/rronik "rronik (1 commits)")

---

Tags

notificationssubscriptionslaravelrubik-llclaravel-notification-manager

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/rubik-llc-laravel-notification-manager/health.svg)

```
[![Health](https://phpackages.com/badges/rubik-llc-laravel-notification-manager/health.svg)](https://phpackages.com/packages/rubik-llc-laravel-notification-manager)
```

###  Alternatives

[vormkracht10/laravel-mails

Laravel Mails can collect everything you might want to track about the mails that has been sent by your Laravel app.

24149.7k](/packages/vormkracht10-laravel-mails)[xammie/mailbook

Laravel Mail Explorer

482458.3k1](/packages/xammie-mailbook)[spatie/laravel-notification-log

Log notifications sent by your Laravel app

207902.8k](/packages/spatie-laravel-notification-log)[wnx/laravel-sends

Keep track of outgoing emails in your Laravel application.

200427.3k](/packages/wnx-laravel-sends)[spatie/laravel-discord-alerts

Send a message to Discord

151408.0k](/packages/spatie-laravel-discord-alerts)[backstage/laravel-mails

Laravel Mails can collect everything you might want to track about the mails that has been sent by your Laravel app.

24157.5k5](/packages/backstage-laravel-mails)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
