定制 tkaratug/laravel-notification-event-subscriber 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

tkaratug/laravel-notification-event-subscriber

最新稳定版本:1.4.0

Composer 安装命令:

composer require tkaratug/laravel-notification-event-subscriber

包简介

This is my package laravel-notification-event-subscriber

README 文档

README

image

Laravel Notification Event Subscriber

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

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

You can install the package via composer:

composer require tkaratug/laravel-notification-event-subscriber

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

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 15.36k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 91
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 91
  • Watchers: 3
  • Forks: 7
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-09-09