Skip to content

微信小程序模板消息群发,laravel实现

Notifications You must be signed in to change notification settings

zhuman90/laravel-wfc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

laravel-wfc

微信小程序模板消息群发,laravel实现

安装

composer require laravuel/laravel-wfc

配置

  1. 在 config/app.php 注册 ServiceProvider
'providers' => [
    // ...
    Laravuel\LaravelWFC\ServiceProvider::class,
],
  1. 创建配置文件
php artisan vendor:publish --provider="Laravuel\LaravelWFC\ServiceProvider"
  1. 修改应用根目录下的 config/wfc.php 中对应的参数即可。

使用

  1. 收集一个formId
use Laravuel\LaravelWFC\Collector;

// openid可以根据自身业务来获取
$collector = new Collector($openid);
$collector->save($request->formId);
  1. 给目标用户发送模板消息
use Laravuel\LaravelWFC\Collector;

$collector = new Collector($openid);
$collector->send($openid, [
    'template_id' => 'template-id',
    'page' => 'index',
    'data' => [
        'keyword1' => 'VALUE',
        'keyword2' => 'VALUE2',
        // ...
    ],
]);

About

微信小程序模板消息群发,laravel实现

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages