Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hectorqin/think-wechat
thinkphp5,thinkphp6 wechat sdk
https://github.com/hectorqin/think-wechat
sdk thinkphp thinkphp5 thinkphp6 wechat
Last synced: 2 months ago
JSON representation
thinkphp5,thinkphp6 wechat sdk
- Host: GitHub
- URL: https://github.com/hectorqin/think-wechat
- Owner: hectorqin
- License: mit
- Created: 2019-11-06T06:25:10.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2019-11-06T06:57:36.000Z (about 5 years ago)
- Last Synced: 2024-08-10T21:15:40.391Z (5 months ago)
- Topics: sdk, thinkphp, thinkphp5, thinkphp6, wechat
- Language: PHP
- Homepage:
- Size: 6.84 KB
- Stars: 7
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# think-wechat
微信SDK For ThinkPHP 5.1, ThinkPHP 6.0 基于[overtrue/wechat](https://github.com/overtrue/wechat)
## 框架要求
ThinkPHP >= 5.1
## 安装
```bash
composer require hectorqin/think-wechat
```## 配置
1. 修改配置文件
修改项目根目录下config/wechat.php中对应的参数2. 每个模块基本都支持多账号,默认为 default。
## 使用
### 接受普通消息
```php
server->push(function($message){
return 'hello,world';
});
$app->server->serve()->send();
}
}
```### 获得SDK实例
#### 使用facade
```php
use Hectorqin\ThinkWechat\Facade;$officialAccount = Facade::officialAccount(); // 公众号
$work = Facade::work(); // 企业微信
$payment = Facade::payment(); // 微信支付
$openPlatform = Facade::openPlatform(); // 开放平台
$miniProgram = Facade::miniProgram(); // 小程序
$openWork = Facade::openWork(); // 企业微信第三方服务商
$microMerchant = Facade::microMerchant(); // 小微商户
```以上均支持传入自定义账号:例如
```php
$officialAccount = Facade::officialAccount('test'); // 公众号
```以上均支持传入自定义账号+配置(注:这里的config和配置文件中账号的格式相同):例如
```php
$officialAccount = Facade::officialAccount('',$config); // 公众号
```更多 SDK 的具体使用请参考:[https://easywechat.com](https://easywechat.com)
## License
MIT