PHPackages                             tetthys/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. [Mail &amp; Notifications](/categories/mail)
4. /
5. tetthys/notification

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

tetthys/notification
====================

Framework-agnostic notification core with a thin Laravel integration.

1.0.6(4mo ago)151MITPHPPHP &gt;=8.5

Since Sep 9Pushed 4mo agoCompare

[ Source](https://github.com/tetthys/notification)[ Packagist](https://packagist.org/packages/tetthys/notification)[ RSS](/packages/tetthys-notification/feed)WikiDiscussions dev Synced 1mo ago

READMEChangelog (6)Dependencies (4)Versions (12)Used By (0)

Tetthys Notification (Laravel Integration)
==========================================

[](#tetthys-notification-laravel-integration)

Framework-agnostic notification core with a thin Laravel integration. Designed for queue-safe, idempotent delivery with first-class database inbox support.

---

Overview
--------

[](#overview)

This package provides:

- A **framework-independent Core pipeline**
- A **minimal Laravel integration**
- A built-in **DatabaseChannel** compatible with Laravel’s `notifications` table
- Queue-based fan-out (recipient × channel)
- Idempotent delivery (retry-safe)

The Core never depends on Laravel. Laravel is used only for DI, queue, cache, and database integration.

---

High-level Pipeline
-------------------

[](#high-level-pipeline)

```

Event / Service / Controller
↓
Notify::trigger(...)
↓
NotificationService (Core)

* RBAC check
* recipient preferences
* channel selection
* enqueue DeliveryMessage(s)
  ↓
  Laravel Queue
  ↓
  DeliveryWorker (Core)
* idempotency claim
* template rendering
* Channel::send(...)
  ↓
  DatabaseChannel / EmailChannel / ...

```

**Important design rule**

> *“Database notifications are just another channel.”*

---

Installation (Laravel 12)
-------------------------

[](#installation-laravel-12)

### 1. Install via Composer

[](#1-install-via-composer)

```
composer require tetthys/notification
```

The service provider is auto-discovered.

---

### 2. Publish configuration

[](#2-publish-configuration)

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

This creates:

```
config/tetthys-notification.php
```

---

### 3. Create Laravel notifications table

[](#3-create-laravel-notifications-table)

Use Laravel’s official migration:

```
php artisan notifications:table
php artisan migrate
```

Schema (simplified):

```
notifications
- id (uuid, primary)
- type
- notifiable_type
- notifiable_id
- data (text)
- read_at
- created_at / updated_at
```

---

Default Configuration
---------------------

[](#default-configuration)

```
return [
    'default_channels' => ['database'],

    'channels' => [
        'database' => Tetthys\Notification\Integration\Laravel\Channels\DatabaseChannel::class,
    ],

    'database' => [
        'notifiable_type' => App\Models\User::class,
        'type_class' => Tetthys\Notification\Integration\Laravel\Notifications\TetthysDatabaseNotification::class,
    ],
];
```

By default, **every notification is stored in the database inbox**.

---

Basic Usage
-----------

[](#basic-usage)

### Sending a notification

[](#sending-a-notification)

```
use Tetthys\Notification\Integration\Laravel\Facades\Notify;

Notify::trigger(
    callerRole: 'system',
    type: 'order.paid',
    recipients: [$userId],
    data: [
        'title' => 'Payment completed',
        'body'  => 'Your order has been paid successfully.',
    ],
);
```

What happens:

- A database notification row is created
- The operation is queued
- Delivery is retry-safe and idempotent

---

Event-based Usage (Recommended)
-------------------------------

[](#event-based-usage-recommended)

### 1. Define an event

[](#1-define-an-event)

```
final class OrderPaid
{
    public function __construct(
        public string $orderId,
        public string $userId,
    ) {}
}
```

---

### 2. Listener sends the notification

[](#2-listener-sends-the-notification)

```
use Tetthys\Notification\Integration\Laravel\Facades\Notify;

final class SendOrderPaidNotification
{
    public function handle(OrderPaid $event): void
    {
        Notify::trigger(
            callerRole: 'system',
            type: 'order.paid',
            recipients: [$event->userId],
            data: [
                'title' => 'Payment completed',
                'body'  => "Order ID: {$event->orderId}",
            ],
        );
    }
}
```

---

### 3. Dispatch the event

[](#3-dispatch-the-event)

```
event(new OrderPaid($orderId, $userId));
```

> **Best practice:** Dispatch events *after* DB transactions are committed.

---

Reading Notifications (Laravel-native)
--------------------------------------

[](#reading-notifications-laravel-native)

Because the DatabaseChannel is compatible with Laravel’s schema:

```
$user->notifications;
$user->unreadNotifications;

$notification->markAsRead();
```

No custom queries required.

---

Channels
--------

[](#channels)

- `database` (built-in, default)
- `email`, `sms`, etc. can be added by implementing:

```
Tetthys\Notification\Core\Contracts\Channel
```

All channels share the same pipeline and guarantees.

---

Design Principles
-----------------

[](#design-principles)

- Core is framework-agnostic
- Laravel integration is thin and replaceable
- Database inbox ≠ delivery log
- Channels are symmetric (DB is not special-cased)
- Queue retries are safe by design

---

Summary
-------

[](#summary)

- Use `Notify::trigger(...)` anywhere
- Prefer **events + listeners**
- Database notifications work out of the box
- Extend by adding channels, not branching logic

This package is optimized for **real-world Laravel applications** that need clean architecture without sacrificing developer experience.

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance74

Regular maintenance activity

Popularity10

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity60

Established project with proven stability

 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 ~11 days

Recently: every ~0 days

Total

11

Last Release

140d ago

Major Versions

0.0.4 → 1.0.02025-12-28

PHP version history (2 changes)0.0.1PHP &gt;=8.1

1.0.0PHP &gt;=8.5

### Community

Maintainers

![](https://www.gravatar.com/avatar/858f92afec0ff81e6888c9ae6f363b56ebf82e45a32d9e1b37341569c5d1b267?d=identicon)[tetthys](/maintainers/tetthys)

---

Top Contributors

[![tetthys](https://avatars.githubusercontent.com/u/115064626?v=4)](https://github.com/tetthys "tetthys (3 commits)")

### Embed Badge

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

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

###  Alternatives

[illuminate/notifications

The Illuminate Notifications package.

483.0M967](/packages/illuminate-notifications)[laravel-notification-channels/telegram

Telegram Notifications Channel for Laravel

1.1k3.4M35](/packages/laravel-notification-channels-telegram)[mckenziearts/laravel-notify

Flexible flash notifications for Laravel

1.7k1.1M5](/packages/mckenziearts-laravel-notify)[s-ichikawa/laravel-sendgrid-driver

This library adds a 'sendgrid' mail driver to Laravel.

4139.3M1](/packages/s-ichikawa-laravel-sendgrid-driver)[propaganistas/laravel-disposable-email

Disposable email validator

5762.6M6](/packages/propaganistas-laravel-disposable-email)[laravel-notification-channels/twilio

Provides Twilio notification channel for Laravel

2587.7M12](/packages/laravel-notification-channels-twilio)

PHPackages © 2026

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