PHPackages                             tkaratug/laravel-notification-event-subscriber - 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. tkaratug/laravel-notification-event-subscriber

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

tkaratug/laravel-notification-event-subscriber
==============================================

This is my package laravel-notification-event-subscriber

1.4.0(1y ago)9115.4k7MITPHPPHP ^8.1 | ^8.2 | ^8.3

Since Sep 9Pushed 1y ago3 watchersCompare

[ Source](https://github.com/tkaratug/laravel-notification-event-subscriber)[ Packagist](https://packagist.org/packages/tkaratug/laravel-notification-event-subscriber)[ Docs](https://github.com/tkaratug/laravel-notification-event-subscriber)[ RSS](/packages/tkaratug-laravel-notification-event-subscriber/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (5)Dependencies (4)Versions (9)Used By (0)

[![image](https://camo.githubusercontent.com/dd8930abc4a8ed4861470feebaa2220ea2411989717b6965d4098519e719e1c5/68747470733a2f2f62616e6e6572732e6265796f6e64636f2e64652f4c61726176656c2532304e6f74696669636174696f6e2532304576656e74253230537562736372696265722e706e673f7468656d653d6c69676874267061636b6167654d616e616765723d636f6d706f7365722b72657175697265267061636b6167654e616d653d746b6172617475672532466c61726176656c2d6e6f74696669636174696f6e2d6576656e742d73756273637269626572267061747465726e3d617263686974656374267374796c653d7374796c655f31266465736372697074696f6e3d266d643d312673686f7757617465726d61726b3d3026666f6e7453697a653d313030707826696d616765733d62656c6c267769647468733d32303026686569676874733d323030)](https://camo.githubusercontent.com/dd8930abc4a8ed4861470feebaa2220ea2411989717b6965d4098519e719e1c5/68747470733a2f2f62616e6e6572732e6265796f6e64636f2e64652f4c61726176656c2532304e6f74696669636174696f6e2532304576656e74253230537562736372696265722e706e673f7468656d653d6c69676874267061636b6167654d616e616765723d636f6d706f7365722b72657175697265267061636b6167654e616d653d746b6172617475672532466c61726176656c2d6e6f74696669636174696f6e2d6576656e742d73756273637269626572267061747465726e3d617263686974656374267374796c653d7374796c655f31266465736372697074696f6e3d266d643d312673686f7757617465726d61726b3d3026666f6e7453697a653d313030707826696d616765733d62656c6c267769647468733d32303026686569676874733d323030)

Laravel Notification Event Subscriber
=====================================

[](#laravel-notification-event-subscriber)

[![Latest Version on Packagist](https://camo.githubusercontent.com/96e926b21b8a34bde074b4d394e0cda23ba8a4dcea16e9018dad31f5584ace8e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f746b6172617475672f6c61726176656c2d6e6f74696669636174696f6e2d6576656e742d737562736372696265722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tkaratug/laravel-notification-event-subscriber)[![GitHub Tests Action Status](https://camo.githubusercontent.com/3395a16e797b8ac9125aa9cee3b4471d1cbf89be628168ee677e93332855ba08/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f746b6172617475672f6c61726176656c2d6e6f74696669636174696f6e2d6576656e742d737562736372696265722f72756e2d74657374733f6c6162656c3d7465737473)](https://github.com/tkaratug/laravel-notification-event-subscriber/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/81637d36a881f5823f2e606470c78a4552479ade1845be790fed2957e2fc910c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f746b6172617475672f6c61726176656c2d6e6f74696669636174696f6e2d6576656e742d737562736372696265722f466978253230504850253230636f64652532307374796c652532306973737565733f6c6162656c3d636f64652532307374796c65)](https://github.com/tkaratug/laravel-notification-event-subscriber/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/f36dcc10c31a43167212d8bc4675853a9e1234c6b7be132bc8fd64c40591a1ce/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f746b6172617475672f6c61726176656c2d6e6f74696669636174696f6e2d6576656e742d737562736372696265722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tkaratug/laravel-notification-event-subscriber)

This package allows you to run any kind of actions while a notification is being sent or after it has been sent using `onSent()` and `onSending()` methods.

It registers an event subscriber `NotificationEventSubscriber` and listens to the `NotificationSent` and `NotificationSending` events of Laravel. When one of them is fired, the event subscriber runs a defined method according to the event.

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

[](#installation)

You can install the package via composer:

```
composer require tkaratug/laravel-notification-event-subscriber
```

Usage
-----

[](#usage)

```
namespace App\Notifications;

use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Support\Facades\Log;

class UserRegisteredNotification extends Notification
{
    public function via($notifiable): array
    {
        return ['mail'];
    }

    public function toMail($notifiable): MailMessage
    {
        return (new MailMessage)
                    ->greeting('foo')
                    ->line('bar');
    }

    public function onSending($notifiable, $channel, $response = null): void
    {
        Log::info($this::class . ' is being sent to  via ' . $channel);
    }

    public function onSent($notifiable, $channel): void
    {
        Log::info($this::class . ' has been sent to  via ' . $channel);
    }
}
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

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

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

[](#contributing)

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

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

[](#security-vulnerabilities)

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

Credits
-------

[](#credits)

- [Turan Karatuğ](https://github.com/tkaratug)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

43

—

FairBetter than 91% of packages

Maintenance40

Moderate activity, may be stable

Popularity36

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 85.7% 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 ~207 days

Total

5

Last Release

510d ago

PHP version history (3 changes)1.0.0PHP ^8.1

1.3.0PHP ^8.1 | ^8.2

1.4.0PHP ^8.1 | ^8.2 | ^8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/50dc98a0c75a1aaba61d52bb073e1b0cbdb17f4d5ed4bd1c694c71784b088e16?d=identicon)[tkaratug](/maintainers/tkaratug)

---

Top Contributors

[![tkaratug](https://avatars.githubusercontent.com/u/4394344?v=4)](https://github.com/tkaratug "tkaratug (24 commits)")[![aydinfatih](https://avatars.githubusercontent.com/u/14280894?v=4)](https://github.com/aydinfatih "aydinfatih (2 commits)")[![JVercout](https://avatars.githubusercontent.com/u/2979532?v=4)](https://github.com/JVercout "JVercout (2 commits)")

---

Tags

laraveltkaratuglaravel-notification-event-subscriber

###  Code Quality

TestsPHPUnit

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/tkaratug-laravel-notification-event-subscriber/health.svg)

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

###  Alternatives

[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)[propaganistas/laravel-disposable-email

Disposable email validator

5762.6M6](/packages/propaganistas-laravel-disposable-email)[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)[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)

PHPackages © 2026

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