PHPackages                             audentio/laravel-notifications - 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. audentio/laravel-notifications

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

audentio/laravel-notifications
==============================

Base notifications and notification preferences system for Audentio platforms.

0.3.20(2mo ago)02.1k↓14.3%2MITPHPPHP &gt;=8.1CI passing

Since Jul 22Pushed 2mo ago2 watchersCompare

[ Source](https://github.com/Audentio/laravel-notifications)[ Packagist](https://packagist.org/packages/audentio/laravel-notifications)[ RSS](/packages/audentio-laravel-notifications/feed)WikiDiscussions master Synced today

READMEChangelog (10)Dependencies (5)Versions (57)Used By (0)

laravel-notifications
=====================

[](#laravel-notifications)

[![Tests](https://github.com/audentio/laravel-notifications/actions/workflows/tests.yml/badge.svg)](https://github.com/audentio/laravel-notifications/actions/workflows/tests.yml)[![Latest Version on Packagist](https://camo.githubusercontent.com/54de9a22c49ceb6db8159f473bd6e552a35227765713bca82e590bebdd2e9c0f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f617564656e74696f2f6c61726176656c2d6e6f74696669636174696f6e732e737667)](https://packagist.org/packages/audentio/laravel-notifications)[![PHP Version](https://camo.githubusercontent.com/f89842376b0ce50e6f0a29b5e16a464c973c8750596b0f930240cb7226f6a2a2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f617564656e74696f2f6c61726176656c2d6e6f74696669636174696f6e732e737667)](https://packagist.org/packages/audentio/laravel-notifications)[![License](https://camo.githubusercontent.com/5566df5a691a7047d93d0124875a8d24bedabebcb61fafc797860ead503b8e4f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f617564656e74696f2f6c61726176656c2d6e6f74696669636174696f6e732e737667)](LICENSE)

Notifications and notification preference system for Audentio Laravel platforms. Provides a database-backed notification preference system with per-channel defaults, per-tenant overrides, per-user overrides, a GraphQL API, and optional push notification support.

Requirements
------------

[](#requirements)

- PHP 8.1+
- Laravel 12
- [`audentio/laravel-base`](https://github.com/audentio/laravel-base)

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

[](#installation)

```
composer require audentio/laravel-notifications
```

Publish and run the migrations:

```
php artisan vendor:publish --tag=audentio-notifications-config
php artisan migrate
```

Publish the model stubs:

```
php artisan vendor:publish --tag=audentio-notifications-models
```

Setup
-----

[](#setup)

### 1. Implement models

[](#1-implement-models)

The published stubs in `app/Models/` need to be wired up to your application. At minimum:

**`NotificationPreference`** — extend `getDefaultUserNotificationPreferenceValue()` if needed. The `getName()` method must return a human-readable label (typically from a translation key).

**`NotificationPreferenceGroup`** — same, `getName()` must be implemented.

**`UserNotificationPreference`** — no changes needed beyond the stub.

### 2. Add the trait to your User model

[](#2-add-the-trait-to-your-user-model)

```
use Audentio\LaravelNotifications\Models\Interfaces\NotifiableUserInterface;
use Audentio\LaravelNotifications\Models\Traits\NotifiableUserTrait;

class User extends Model implements NotifiableUserInterface
{
    use NotifiableUserTrait;

    public function isEmailVerified(): bool
    {
        return $this->email_verified_at !== null;
    }
}
```

### 3. Create notification handlers

[](#3-create-notification-handlers)

Extend `AbstractNotification` and implement `getNotificationPreferenceId()`:

```
use Audentio\LaravelNotifications\Notifications\AbstractNotification;

class NewMessageNotification extends AbstractNotification
{
    public function getNotificationPreferenceId(): string
    {
        return 'newMessage';
    }

    public function toMail($notifiable): MailMessage
    {
        return (new MailMessage)->subject('New message');
    }
}
```

### 4. Seed preferences

[](#4-seed-preferences)

Run your `NotificationPreferencesAndGroupsTableSeeder` after adding handlers. The seeder auto-discovers handlers and creates `NotificationPreference` records.

Notification Preference Hierarchy
---------------------------------

[](#notification-preference-hierarchy)

User preferences follow a 3-level fallback (highest priority first):

LevelSourceStored in3User override`user_notification_preferences.disabled_channels`2Tenant overrideApp-provided via `getNotificationPreferenceTenantDefaults()`1Global default`notification_preferences.default_disabled_channels`When no record exists at a level, the next level is used. An empty `disabled_channels` array means all channels are enabled.

### Setting global defaults

[](#setting-global-defaults)

Set `default_disabled_channels` when seeding a preference:

```
'streamGoLive' => [
    'available_channels' => ['notification', 'mail'],
    'default_disabled_channels' => ['mail'], // mail off by default for all users
],
```

### Tenant-level overrides

[](#tenant-level-overrides)

Override `getNotificationPreferenceTenantDefaults()` on your User model to load tenant-specific defaults. This is called once per `getUserNotificationPreferenceValues()` call — load all tenant preferences in a single query:

```
public function getNotificationPreferenceTenantDefaults(): Collection
{
    $tenant = $this->getCurrentTenant();
    if (!$tenant) {
        return collect();
    }
    return TenantNotificationPreference::where('tenant_id', $tenant->id)->get();
}
```

Optional: Disable automatic migrations
--------------------------------------

[](#optional-disable-automatic-migrations)

If you manage migrations manually:

```
// In a service provider
LaravelNotifications::skipMigrations();
```

Optional: Push notifications
----------------------------

[](#optional-push-notifications)

Enable push support in `config/audentioNotifications.php`:

```
'push_enabled' => true,
'push_handler_classes' => [
    'expo' => \Audentio\LaravelNotifications\PushHandlers\ExpoPushHandler::class,
    'fcm'  => \Audentio\LaravelNotifications\PushHandlers\FirebasePushHandler::class,
],
```

Run the additional push migrations:

```
php artisan migrate
```

Push subscriptions are managed via the `routeNotificationForPush()` method on your User model (provided by `NotifiableUserTrait` — override if needed).

GraphQL
-------

[](#graphql)

The package auto-registers a GraphQL schema when `audentio/laravel-graphql` is present. Exposed types, queries, and mutations include:

- **Queries**: `notifications`, `notificationPreferenceGroups`
- **Mutations**: `updateViewerNotificationPreferenceValue`, `dismissNotification`, `markReadNotification`, `markUnreadNotification`, `markReadAllNotifications`, `dismissAllNotifications`
- **Types**: `NotificationPreference`, `NotificationPreferenceGroup`, `UserNotificationPreferenceValue`, `NotificationChannelEnum`

Override individual types via `graphQL_schema_overrides` in the config.

To disable GraphQL registration:

```
LaravelNotifications::skipGraphQLSchema();
```

Testing
-------

[](#testing)

```
composer test
```

License
-------

[](#license)

MIT

###  Health Score

49

—

FairBetter than 94% of packages

Maintenance88

Actively maintained with recent releases

Popularity20

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 94.4% 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

Every ~32 days

Recently: every ~27 days

Total

55

Last Release

60d ago

PHP version history (2 changes)0.0.1-beta.1PHP &gt;=8.0

0.2.4PHP &gt;=8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/d939e98939cc044e9af68c9f67895797aeaa7d4e4f76ad181aefbc72766895fe?d=identicon)[audentio](/maintainers/audentio)

---

Top Contributors

[![JakeBooher](https://avatars.githubusercontent.com/u/179180?v=4)](https://github.com/JakeBooher "JakeBooher (68 commits)")[![ilijavuk](https://avatars.githubusercontent.com/u/16703183?v=4)](https://github.com/ilijavuk "ilijavuk (4 commits)")

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/audentio-laravel-notifications/health.svg)

```
[![Health](https://phpackages.com/badges/audentio-laravel-notifications/health.svg)](https://phpackages.com/packages/audentio-laravel-notifications)
```

###  Alternatives

[maize-tech/laravel-email-domain-rule

Laravel Email Domain Rule

612.0k](/packages/maize-tech-laravel-email-domain-rule)[sarfraznawaz2005/noty

Laravel package to incorporate noty flash notifications into laravel.

324.5k](/packages/sarfraznawaz2005-noty)

PHPackages © 2026

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