ywmelo/template-message

Wechat template message
2,219 4
Install
composer require ywmelo/template-message
Latest Version:v1.1
PHP:>=7.0.0
License:MIT
Last Updated:May 6, 2021
Links: GitHub  ·  Packagist
Maintainer: Melo Yang

EasyWechat template message notification for Laravel

使用 EasyWechat 的模板消息功能发送 Laravel 消息通知。

安装

composer require ywmelo/template-message

使用

创建通知:

namespace App\Notifications;

use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Ywmelo\TemplateMessage\Message\WechatTemplateMessage;
use Ywmelo\TemplateMessage\Channels\WechatTemplateMessageChannel;

class WechatTemplateMessageNotification extends Notification
{
    use Queueable;

    public function __construct($formId)
    {
        $this->formId = $formId;
    }

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

    public function toWechatTemplateMessage($notifiable)
    {
        return (new WechatTemplateMessage)
            ->setTemplateId('template_id')
            ->setPage('page')
            ->setFormId($this->formId)
            ->setData([
                'keyword1' => 'keyword1',
                'keyword2' => 'keyword2',
                'keyword3' => 'keyword3',
                'keyword4' => 'keyword4',
            ]);
    }
}

发送

$user->notify(new WechatTemplateMessageNotification($formId));

Related Packages

szykra/laravel-flash-notifications

Easy way to display Flash Notifications in Laravel 5.

38,425 8
laravel-notification-channels/plivo

Plivo SMS notifications driver for Laravel

16,260 9
overtrue/laravel-wechat

微信 SDK for Laravel

1,880,006 2,897
benwilkins/laravel-fcm-notification

Laravel FCM (Firebase Cloud Messaging) Notification Channel

976,506 208