PHPackages                             okaufmann/laravel-notification-log - 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. [Logging &amp; Monitoring](/categories/logging)
4. /
5. okaufmann/laravel-notification-log

ActiveLibrary[Logging &amp; Monitoring](/categories/logging)

okaufmann/laravel-notification-log
==================================

Logs every sent Notification and Mail of your entire Project.

v6.0.0(1mo ago)421.2k↓18.2%1[3 PRs](https://github.com/okaufmann/laravel-notification-log/pulls)MITPHPPHP ^8.3CI passing

Since Oct 10Pushed 1mo agoCompare

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

READMEChangelog (10)Dependencies (36)Versions (38)Used By (0)

Laravel Notification Log
========================

[](#laravel-notification-log)

[![Latest Version on Packagist](https://camo.githubusercontent.com/2ecfdafa5d0def929df524edbf716a3f6df459ef5d412c2be904f1ba14a2874b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6f6b6175666d616e6e2f6c61726176656c2d6e6f74696669636174696f6e2d6c6f672e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/okaufmann/laravel-notification-log)[![Tests](https://github.com/okaufmann/laravel-notification-log/actions/workflows/run-tests.yml/badge.svg)](https://github.com/okaufmann/laravel-notification-log/actions/workflows/run-tests.yml)[![PHPStan](https://github.com/okaufmann/laravel-notification-log/actions/workflows/phpstan.yml/badge.svg)](https://github.com/okaufmann/laravel-notification-log/actions/workflows/phpstan.yml)[![Check & fix styling](https://github.com/okaufmann/laravel-notification-log/actions/workflows/php-code-style.yml/badge.svg)](https://github.com/okaufmann/laravel-notification-log/actions/workflows/php-code-style.yml)[![Total Downloads](https://camo.githubusercontent.com/15450a43ff6f49d32e3250784da73897514da6d29c57eac242c16f624af62caa/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6f6b6175666d616e6e2f6c61726176656c2d6e6f74696669636174696f6e2d6c6f672e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/okaufmann/laravel-notification-log)

Logs every sent Notification of your entire Laravel Project.

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

[](#installation)

You can install the package via composer:

```
composer require okaufmann/laravel-notification-log
```

You can publish and run the migrations with:

```
php artisan vendor:publish --tag="notification-log-migrations"
php artisan migrate
```

You can publish the config file with:

```
php artisan vendor:publish --tag="notification-log-config"
```

The following config file will be published in config/notification-log.php:

```
return [

    /*
    |--------------------------------------------------------------------------
    | Resolve Notification Message
    |--------------------------------------------------------------------------
    |
    | If this is enabled, the Logger will try to resolve the built message
    | out of the notification. This is useful if you want to debug your
    | sent notifications.
    |
    */

    'resolve_notification_message' => env('NOTIFICATION_LOG_RESOLVE_NOTIFICATION_MESSAGE', false),
];
```

Usage
-----

[](#usage)

Add the following Interface and Trait to your Notification:

```
use Okaufmann\LaravelNotificationLog\Contracts\ShouldLogNotification;use Okaufmann\LaravelNotificationLog\Models\Concerns\LogsNotifications;

class DummyNotification extends Notification implements ShouldLogNotification
{
    use LogsNotifications;

    // ...

}
```

Now send a Notification or Mail as you would normally do. The package will automatically log the Notification or Mail.

Custom Message Resolution
-------------------------

[](#custom-message-resolution)

If you want to customize how the notification message is resolved for logging purposes, you can implement the `ResolveMessageForLogging` interface:

```
use Okaufmann\LaravelNotificationLog\Contracts\ShouldLogNotification;
use Okaufmann\LaravelNotificationLog\Contracts\ResolveMessageForLogging;
use Okaufmann\LaravelNotificationLog\Models\Concerns\LogsNotifications;

class CustomNotification extends Notification implements ShouldLogNotification, ResolveMessageForLogging
{
    use LogsNotifications;

    public function resolveMessageForLogging(string $channel, $notifiable): string
    {
        $channelName = get_class($channel);
        $notifiableName = get_class($notifiable);

        return "Custom message for {$channelName} channel sent to {$notifiableName}";
    }
}
```

When a notification implements `ResolveMessageForLogging`, the logger will use your custom method instead of the default message resolution logic. This gives you full control over what gets stored in the `message` field of the notification log.

Resolving Messages After Sending
--------------------------------

[](#resolving-messages-after-sending)

For special channels like WhatsApp, Telegram, or other messaging services where templates are stored externally and the actual message content is only available after sending, you can implement the `ResolveMessageForLoggingAfterSent` interface:

```
use Okaufmann\LaravelNotificationLog\Contracts\ShouldLogNotification;
use Okaufmann\LaravelNotificationLog\Contracts\ResolveMessageForLoggingAfterSent;
use Okaufmann\LaravelNotificationLog\Models\Concerns\LogsNotifications;

class WhatsAppNotification extends Notification implements ShouldLogNotification, ResolveMessageForLoggingAfterSent
{
    use LogsNotifications;

    public function resolveMessageForLoggingAfterSent(mixed $channel, $notifiable, $response): ?string
    {
        // Extract the actual message content from the WhatsApp API response
        if (isset($response['message_id'])) {
            return "WhatsApp message sent with ID: {$response['message_id']}";
        }

        return null;
    }
}
```

This interface is particularly useful for channels where:

- Templates are stored externally (like WhatsApp Business API)
- The actual message content is only available after sending
- You need to extract information from the channel's response data

The method is called during the `NotificationSent` event, allowing you to resolve the message content using the response data from the channel after the notification has been successfully sent.

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

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

Credits
-------

[](#credits)

- [Oliver Kaufmann](https://github.com/okaufmann)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

55

—

FairBetter than 98% of packages

Maintenance89

Actively maintained with recent releases

Popularity32

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity73

Established project with proven stability

 Bus Factor1

Top contributor holds 88.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 ~42 days

Total

31

Last Release

56d ago

Major Versions

v1.3.3 → v2.0.02023-08-18

2.1.0 → 3.0.02024-07-17

3.0.0 → 4.0.02024-09-25

4.6.0 → 5.0.02025-03-09

5.2.2 → v6.0.02026-03-23

PHP version history (2 changes)v1.0.0PHP ^8.1

2.0.1PHP ^8.3

### Community

Maintainers

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

---

Top Contributors

[![okaufmann](https://avatars.githubusercontent.com/u/4414498?v=4)](https://github.com/okaufmann "okaufmann (181 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (10 commits)")[![Sparclex](https://avatars.githubusercontent.com/u/2805213?v=4)](https://github.com/Sparclex "Sparclex (8 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (5 commits)")

---

Tags

laravellaravel-notification-log

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

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

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

###  Alternatives

[spatie/laravel-health

Monitor the health of a Laravel application

86910.0M83](/packages/spatie-laravel-health)[spatie/laravel-slack-alerts

Send a message to Slack

3212.6M4](/packages/spatie-laravel-slack-alerts)[keepsuit/laravel-opentelemetry

OpenTelemetry integration for laravel

142347.8k](/packages/keepsuit-laravel-opentelemetry)[spatie/laravel-error-share

Share your Laravel errors to Flare

43965.6k3](/packages/spatie-laravel-error-share)[yoeriboven/laravel-log-db

A database driver for logging with Laravel

58156.5k](/packages/yoeriboven-laravel-log-db)[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)
