laravuel / laravel-wfc
There is no license information available for the latest version (1.0.0) of this package.
微信小程序模板消息群发,laravel实现
1.0.0
2018-10-27 14:32 UTC
Requires
- overtrue/wechat: ~4.0
This package is auto-updated.
Last update: 2024-10-28 04:28:58 UTC
README
微信小程序模板消息群发,laravel实现
安装
composer require laravuel/laravel-wfc
配置
- 在 config/app.php 注册 ServiceProvider
'providers' => [
// ...
Laravuel\LaravelWFC\ServiceProvider::class,
],
- 创建配置文件
php artisan vendor:publish --provider="Laravuel\LaravelWFC\ServiceProvider"
- 修改应用根目录下的 config/wfc.php 中对应的参数即可。
使用
- 收集一个formId
use Laravuel\LaravelWFC\Collector;
// openid可以根据自身业务来获取
$collector = new Collector($openid);
$collector->save($request->formId);
- 给目标用户发送模板消息
use Laravuel\LaravelWFC\Collector;
$collector = new Collector($openid);
$collector->send($openid, [
'template_id' => 'template-id',
'page' => 'index',
'data' => [
'keyword1' => 'VALUE',
'keyword2' => 'VALUE2',
// ...
],
]);