项目作者: mucts

项目描述 :
基于Laravel Notification的微信小程序订阅消息推送
高级语言: PHP
项目地址: git://github.com/mucts/laravel-weapp-subscribe-notification.git


微信模版订阅消息插件

环境需求

用于 Lumen 框架的微信小程序订阅消息服务通知

  1. PHP >= 7.1.3
  2. OpenSSL PHP Extension
  3. PDO PHP Extension
  4. Mbstring PHP Extension
  5. Redis >= 3.2.0
  6. MySQL >= 5.7.5
  7. laravel/framework ^7.0
  8. overtrue/laravel-wechat ~5.0
  9. predis/predis ^1.1

安装

  1. composer require mucts/laravel-weapp-subscribe-notification

Laravel 配置方法

由于设置了 Laravel providers 自动加载,所以不需要额外操作。

Lumen 配置方法

bootstrap/app.php 中增加:

  1. $app->register(MuCTS\Laravel\WeAppSubscribeNotification\SubscribeServiceProvider::class);

模版配置文件

文件名称:config/wechat_subscribe_template.php

文件格式:

  1. <?php
  2. return [
  3. 'default' => [
  4. [
  5. "tid" => '',// 订阅消息模版库标题ID
  6. 'keywords' => [],// 模版关键词
  7. 'scenes' => [],// 场景
  8. 'type' => MuCTS\Laravel\WeAppSubscribeNotification\Models\WeAppSubscribeNotification::TYPES[2],// 消息类型
  9. 'name' => ''// 模版标题
  10. ]
  11. ]
  12. ]
  13. ?>

清空模版

  1. php artisan weapp:subscribe:drop

更新模版

  1. php artisan weapp:subscribe:update