teamnovu / laravel-notification-log
Logs every sent Notification and Mail of your entire Project.
Installs: 4 619
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 0
Forks: 2
Open Issues: 0
Requires
- php: ^8.1
- ext-zlib: *
- illuminate/contracts: ^9.0|^10.0
- spatie/laravel-package-tools: ^1.13.0
Requires (Dev)
- laravel-notification-channels/telegram: ^3.0|^4.0
- laravel-notification-channels/webpush: ^7.0
- laravel/pint: ^1.0
- laravel/vonage-notification-channel: ^3.0
- nunomaduro/collision: ^6.0
- orchestra/testbench: ^7.0
- pestphp/pest: ^1.21
- pestphp/pest-plugin-laravel: ^1.1
- phpunit/phpunit: ^9.5
- spatie/laravel-ray: ^1.26
README
Logs every sent Notification and Mail of your entire Laravel Project.
Installation
You can install the package via composer:
composer require teamnovu/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 [ /* |-------------------------------------------------------------------------- | Compress Messages |-------------------------------------------------------------------------- | | In case you send a lot of E-Mails the message_sent_logs table could become | very big. With this option you can enable that the body of every log | entry will be compressed with gzip to reduce its size. | */ 'compress-messages' => env('NOTIFICATION_LOG_COMPRESS_MESSAGES', false), /* |-------------------------------------------------------------------------- | 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
Add the following Interface and Trait to your Notification:
use Teamnovu\LaravelNotificationLog\Concerns\LogNotification; use Teamnovu\LaravelNotificationLog\Contracts\ShouldLogNotification; class DummyNotification extends Notification implements ShouldLogNotification { use LogNotification; // ... }
Now send a Notification or Mail as you would normally do. The package will automatically log the Notification or Mail.
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Credits
License
The MIT License (MIT). Please see License File for more information.