PHPackages                             karnoweb/laravel-notification - 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. [Database &amp; ORM](/categories/database)
4. /
5. karnoweb/laravel-notification

ActiveLibrary[Database &amp; ORM](/categories/database)

karnoweb/laravel-notification
=============================

Multi-channel notification business layer for Laravel

13.0.0(1mo ago)022PHPPHP ^8.3

Since Mar 10Pushed 5mo agoCompare

[ Source](https://github.com/karnoweb/laravel-notification)[ Packagist](https://packagist.org/packages/karnoweb/laravel-notification)[ RSS](/packages/karnoweb-laravel-notification/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (12)Versions (3)Used By (0)

Karnoweb Laravel Notification
=============================

[](#karnoweb-laravel-notification)

Multi-channel notification business layer for Laravel: configurable channels per event, user and global overrides, templates, logging and queuing.

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

[](#installation)

```
composer require karnoweb/laravel-notification
```

### Publish config (optional)

[](#publish-config-optional)

```
php artisan vendor:publish --tag=karnoweb-notification-config
```

Migrations run automatically from the package; run `php artisan migrate` to create package tables (with prefix).

Configuration
-------------

[](#configuration)

In `config/karnoweb-notification.php`:

- **table\_prefix**: Prefix for package tables (default: `karnoweb_`). Tables: `{prefix}notification_logs`, `{prefix}notification_templates`, `{prefix}notification_preferences`.
- **channels**: Default and per-event channel config (`enabled`, `togglable`).
- **queued\_channels**: Channels that are sent via queue (e.g. `['email', 'sms']`).
- **queue\_jobs**: Job class per channel for queued sending.
- **log\_model**: Model used for notification logs (default: package model).
- **mailable**: Mailable class for email channel (receives payload array).
- **template\_model**: Model for notification templates (default: package `NotificationTemplate`).

Usage
-----

[](#usage)

### Sending a notification

[](#sending-a-notification)

Build a `NotificationMessage` with event (string), context and per-channel payloads, then dispatch:

```
use Karnoweb\LaravelNotification\NotificationChannelEnum;
use Karnoweb\LaravelNotification\NotificationDispatcher;
use Karnoweb\LaravelNotification\Messages\NotificationMessage;

$message = NotificationMessage::make('auth_register')
    ->withContext(['user_name' => $user->name, 'action_url' => url('/login')])
    ->withChannel(NotificationChannelEnum::DATABASE, ['title' => '...', 'body' => '...'])
    ->withChannel(NotificationChannelEnum::EMAIL, ['subject' => '...', 'body' => '...']);

app(NotificationDispatcher::class)->dispatch($user, $message, $profile, [
    'notification_class' => RegisterNotification::class,
]);
```

### Custom drivers

[](#custom-drivers)

Implement `Karnoweb\LaravelNotification\Contracts\NotificationChannelDriver` and register in your app service provider:

```
$this->app->singleton(
    \Karnoweb\LaravelNotification\NotificationChannelEnum::SMS->driverBinding(),
    \App\Notifications\Drivers\SmsChannelDriver::class
);
```

### User and global overrides

[](#user-and-global-overrides)

Implement and bind:

- `Karnoweb\LaravelNotification\Contracts\GlobalChannelOverridesResolver` (admin settings per event).
- `Karnoweb\LaravelNotification\Contracts\UserChannelOverridesResolver` (user/profile settings per event).

Then `NotificationPreferenceResolver` will use them when resolving enabled channels.

### Queued jobs

[](#queued-jobs)

Extend `Karnoweb\LaravelNotification\Jobs\SendChannelNotificationJob` and define `channel()`:

```
namespace App\Jobs\Notifications;

use Karnoweb\LaravelNotification\Jobs\SendChannelNotificationJob;
use Karnoweb\LaravelNotification\NotificationChannelEnum;

class SendEmailNotificationJob extends SendChannelNotificationJob
{
    protected function channel(): NotificationChannelEnum
    {
        return NotificationChannelEnum::EMAIL;
    }
}
```

Set `queue_jobs.email` (and `queue_jobs.sms`) in config to your job classes.

### Direct send (no Notification class)

[](#direct-send-no-notification-class)

Send from anywhere without defining a notification class:

```
use Karnoweb\LaravelNotification\NotificationService;

$service = app(NotificationService::class);

// Synchronous: builds message and dispatches (email/sms still queued by channel)
$service->sendDirect($user, 'order_ready', [
    'database' => ['title' => 'Order ready', 'body' => 'Your order #123 is ready.'],
    'email' => ['subject' => 'Order ready', 'body' => '...'],
], $profile, ['notification_class' => null]);

// Entire send queued (dispatcher runs in a job)
$service->queueSendDirect($user, 'order_ready', [
    'database' => ['title' => 'Order ready', 'body' => '...'],
], $profile);
```

### User preferences (table)

[](#user-preferences-table)

User channel preferences are stored in `{prefix}notification_preferences`. The package provides `DatabaseUserChannelOverridesResolver` by default. Use `NotificationPreference::setChannels($notifiable, $event, $channels)` and `NotificationPreference::getAllForNotifiable($notifiable)` to read/write from your app.

Repository
----------

[](#repository)

- **Git**: `git@github.com:karnoweb/laravel-notification.git`
- **Namespace**: `Karnoweb\LaravelNotification`

### Push to GitHub

[](#push-to-github)

From the package directory:

```
cd packages/karnoweb/laravel-notification
git init
git remote add origin git@github.com:karnoweb/laravel-notification.git
git add .
git commit -m "Initial package"
git branch -M main
git push -u origin main
```

License
-------

[](#license)

MIT

###  Health Score

39

—

LowBetter than 84% of packages

Maintenance82

Actively maintained with recent releases

Popularity9

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~119 days

Total

2

Last Release

33d ago

Major Versions

1.0.0 → 13.0.02026-07-08

PHP version history (2 changes)1.0.0PHP ^8.2

13.0.0PHP ^8.3

### Community

Maintainers

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

---

Top Contributors

[![sajadsoft1](https://avatars.githubusercontent.com/u/10587549?v=4)](https://github.com/sajadsoft1 "sajadsoft1 (1 commits)")

###  Code Quality

TestsPHPUnit

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/karnoweb-laravel-notification/health.svg)

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

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3345.4M354](/packages/psalm-plugin-laravel)[laravel/cashier

Laravel Cashier provides an expressive, fluent interface to Stripe's subscription billing services.

2.6k31.8M158](/packages/laravel-cashier)[spatie/laravel-health

Monitor the health of a Laravel application

88212.7M185](/packages/spatie-laravel-health)[laravel/ai

The official AI SDK for Laravel.

1.1k4.6M293](/packages/laravel-ai)[illuminate/queue

The Illuminate Queue package.

20433.0M1.8k](/packages/illuminate-queue)[fleetbase/core-api

Core Framework and Resources for Fleetbase API

1239.7k25](/packages/fleetbase-core-api)

PHPackages © 2026

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