承接 xcoorp/laravel-novu-notifications 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

xcoorp/laravel-novu-notifications

最新稳定版本:v1.0.0

Composer 安装命令:

composer require xcoorp/laravel-novu-notifications

包简介

Novu Notifications channel for Laravel.

README 文档

README

Software License Laravel Version Requirements

Novu - Laravel Notification Channel

This package makes it easy to send notifications using Novu

class InvoicePaidNotification extends Notification
{
    // Trigger a specific notification event
    public function toNovuEvent($notifiable)
    {
        return NovuMessage::create('workflow_1234')
            ->addVariable('invoice_id', $this->invoice->id)
            ->toSubscriberId('123456789');
    }
}

Contents

Installation

The Novu notification channel can be installed easily via Composer:

$ composer require xcoorp/laravel-novu-notifications

Usage

In order to send a notification via the Novu channel, you'll need to specify the channel in the via() method of your notification:

use NotificationChannels\Novu\NovuChannel;

public function via($notifiable)
{
    return [
        NovuChannel::class
    ]
}

API Overview

Novu Message

Namespace: NotificationChannels\Novu\NovuMessage

The NovuMessage class encompasses an entire message that will be sent to the Novu API.

  • static create(?string $workflowId) Instantiates and returns a new NovuMessage instance, optionally pre-configuring it with the workflow id
  • workflowId(string $workflowId) Set the workflowId of the message (Your novu workflow trigger id)
  • to(array $to) Array of recipient information like subscriberId, phone, etc...
  • toSubscriber(string $subscriberId) Set the subscriberId of the recipient
  • variables(array $variables) Set the variables (payload) of the message. Those are your novu event variables
  • addVariable(string $key, $value) Add a single variable to the message
  • toArray() Returns the data that will be sent to the Novu API as an array

Testing

Functionality of this package is tested with Pest PHP. You can run the tests with:

composer test

Code of Conduct

In order to ensure that the community is welcoming to all, please review and abide by the Code of Conduct.

Security Vulnerabilities

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

License

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

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-06-26