teamnovu / laravel-notification-log
记录项目中发送的每个通知和邮件。
v2.0.0
2023-08-18 23:56 UTC
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
记录整个Laravel项目中发送的每个通知和邮件。
安装
您可以通过composer安装此包
composer require teamnovu/laravel-notification-log
您可以使用以下命令发布和运行迁移
php artisan vendor:publish --tag="notification-log-migrations"
php artisan migrate
您可以使用以下命令发布配置文件
php artisan vendor:publish --tag="notification-log-config"
以下配置文件将发布到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), ];
使用方法
将以下接口和特性添加到您的通知中
use Teamnovu\LaravelNotificationLog\Concerns\LogNotification; use Teamnovu\LaravelNotificationLog\Contracts\ShouldLogNotification; class DummyNotification extends Notification implements ShouldLogNotification { use LogNotification; // ... }
现在可以像平时一样发送通知或邮件。该包将自动记录通知或邮件。
测试
composer test
变更日志
有关最近更改的更多信息,请参阅变更日志。
鸣谢
许可协议
MIT许可协议(MIT)。有关更多信息,请参阅许可文件。