New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

ywmelo/template-message

Wechat template message
2,219 4
Install
composer require ywmelo/template-message
Latest Version:v1.1
PHP:>=7.0.0
Laravel:5 – 8
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

hsinlu/wechat

wechat sdk

55 3
fenos/notifynder

Management system of internal notifications for Laravel 5.*

207,693 423
carropublic/notifications

A collections of notification channels and senders

48,733 0
hugostech/notifynder

Management system of internal notifications for Laravel 10 / 11 / 12 / 13.

4,180 0
difftechnology/notifynder

Management system of internal notifications for Laravel 5.*

32 0

Version History

Version Released PHP Laravel License
v1.1 >=7.0.0 >=5.8.1 MIT
v1.0 ^7.1.3 5.8.* MIT