PHPackages                             anourvalar/eloquent-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. anourvalar/eloquent-notification

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

anourvalar/eloquent-notification
================================

Laravel Notification - model layer

1.5.11(1mo ago)069↓25%MITPHPPHP ^8.4

Since Feb 11Pushed 2mo agoCompare

[ Source](https://github.com/AnourValar/eloquent-notification)[ Packagist](https://packagist.org/packages/anourvalar/eloquent-notification)[ Docs](https://github.com/AnourValar/eloquent-notification)[ RSS](/packages/anourvalar-eloquent-notification/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (20)Versions (13)Used By (0)

Laravel Eloquent Notification
=============================

[](#laravel-eloquent-notification)

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

[](#installation)

**Step #1: Install the package**

```
composer require anourvalar/eloquent-notification
```

**Step #2: Publish the resources**

```
php artisan vendor:publish --provider=AnourValar\\EloquentNotification\\Providers\\AnourValarEloquentNotificationServiceProvider
```

Notification feature
--------------------

[](#notification-feature)

**Step #1: Add notification routes for User model**

```
/**
 * Route notifications for the Telegram channel.
 *
 * @param  \Illuminate\Notifications\Notification  $notification
 * @return string|null
 */
public function routeNotificationForTelegram($notification)
{
    return $this->telegram_chatid; // set your attribute
}

/**
 * Route notifications for the SMS channel.
 *
 * @param  \Illuminate\Notifications\Notification  $notification
 * @return string|null
 */
public function routeNotificationForSms($notification)
{
    return $this->phone; // set your attribute
}

/**
 * Route notifications for the Push channel.
 *
 * @param  \Illuminate\Notifications\Notification  $notification
 * @return string|array|null
 */
public function routeNotificationForPush($notification)
{
    return $this->tokens->pluck('push_token')->toArray(); // set your attribute
}
```

**Step #2: Create a notification**

```
namespace App\Notifications\Triggers;

use Illuminate\Notifications\Messages\MailMessage;

class NewPostNotification extends \AnourValar\EloquentNotification\AbstractNotification
{
    /**
     * Create a new notification instance.
     */
    public function __construct(public \App\Post $post)
    {
        parent::__construct();
    }

    /**
     * Get the mail representation of the notification.
     */
    public function toMail(object $notifiable): MailMessage
    {
        return (new MailMessage)
            ->line($this->post->title)
            ->action('Notification Action', url('/'))
            ->line('Thank you for using our application!');
    }
}
```

**Step #3: Collect (group) notify (optional)**

```
App::make(Service::class)->collectNotify($user, EmailUpdatedNotification::class, []);
```

Confirm feature
---------------

[](#confirm-feature)

**Step #1: Add middleware to the HTTP Kernel**

```
/**
 * The application's middleware aliases.
 *
 * Aliases may be used instead of class names to conveniently assign middleware to routes and groups.
 *
 * @var array
 */
protected $middlewareAliases = [
    //
    'confirm.pow' => \AnourValar\EloquentNotification\Http\Middleware\ConfirmPow::class,
    'confirm.email.input' => \AnourValar\EloquentNotification\Http\Middleware\ConfirmEmailInput::class,
    'confirm.email.my' => \AnourValar\EloquentNotification\Http\Middleware\ConfirmEmailMy::class,
    'confirm.phone.input' => \AnourValar\EloquentNotification\Http\Middleware\ConfirmPhoneInput::class,
    'confirm.phone.my' => \AnourValar\EloquentNotification\Http\Middleware\ConfirmPhoneMy::class,
    'confirm.totp.input' => \AnourValar\EloquentNotification\Http\Middleware\ConfirmTotpInput::class,
    'confirm.totp.my' => \AnourValar\EloquentNotification\Http\Middleware\ConfirmTotpMy::class,
    'confirm.fa.my' => \AnourValar\EloquentNotification\Http\Middleware\ConfirmFaMy::class,
];
```

**Step #2: Explore the ConfirmService**

###  Health Score

44

—

FairBetter than 92% of packages

Maintenance87

Actively maintained with recent releases

Popularity12

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity58

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

Total

12

Last Release

49d ago

### Community

Maintainers

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

---

Top Contributors

[![AnourValar](https://avatars.githubusercontent.com/u/54237693?v=4)](https://github.com/AnourValar "AnourValar (5 commits)")

---

Tags

laravelnotificationeloquentanourvalar

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[anourvalar/eloquent-serialize

Laravel Query Builder (Eloquent) serialization

11320.2M21](/packages/anourvalar-eloquent-serialize)[bavix/laravel-clickhouse

Eloquent model for ClickHouse

72214.1k2](/packages/bavix-laravel-clickhouse)[stayallive/laravel-eloquent-observable

Register Eloquent model event listeners just-in-time directly from the model.

2928.9k7](/packages/stayallive-laravel-eloquent-observable)[waad/laravel-model-metadata

A robust Laravel package for handling metadata with JSON casting, custom relation names, and advanced querying capabilities.

823.1k](/packages/waad-laravel-model-metadata)[mozex/laravel-scout-bulk-actions

A Laravel Scout extension for bulk importing and flushing of all models.

1033.4k](/packages/mozex-laravel-scout-bulk-actions)

PHPackages © 2026

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