Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hanson/wechat-notice
微信消息模板发送
https://github.com/hanson/wechat-notice
Last synced: 24 days ago
JSON representation
微信消息模板发送
- Host: GitHub
- URL: https://github.com/hanson/wechat-notice
- Owner: Hanson
- License: mit
- Created: 2017-02-15T09:32:57.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-02-16T12:12:34.000Z (over 7 years ago)
- Last Synced: 2024-03-14T21:28:16.222Z (8 months ago)
- Language: PHP
- Size: 4.88 KB
- Stars: 22
- Watchers: 2
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# wechat-notice
wechat-notcie 是基于 `laravel` 和 [EasyWechat](https://github.com/overtrue/wechat) 开发的微信消息模板通知功能
## 安装
```
composer require hanson/wechat-notice
```添加 `Hanson\WechatNotice\NoticeServiceProvider::class` 到 `app.php` 的 `providers` 中
## 使用
### config
当不做任何设置时,Notice会自动读取 `config('services.wechat')` 的配置
```
\WechatNotice::send($openId, $templateId, [
'first' => '系统异常',
'keyword1' => '',
'keyword2' => '',
'keyword3' => '',
'remark' => '请及时处理'
]);
```### 已存在实例
```
$wechat = new Application([
'app_id' => $appId,
'secret' => $secret,
]);\WechatNotice::setWechat($wechat)->send($openId, $templateId, [
'first' => '系统异常',
'keyword1' => '',
'keyword2' => '',
'keyword3' => '',
'remark' => '请及时处理'
], null, '#af0505');
```### 直接设置配置
```
\WechatNotice::setConfig([
'app_id' => $appId,
'secret' => $secret,
])->send($openId, $templateId, [
'first' => '系统异常',
'keyword1' => '',
'keyword2' => '',
'keyword3' => '',
'remark' => '请及时处理'
]);
```### 发送给多个用户
```
\WechatNotice::send([$openId, $openId2, $openId3, ...], $templateId, [
'first' => '系统异常',
'keyword1' => '',
'keyword2' => '',
'keyword3' => '',
'remark' => '请及时处理'
]);
```