PHPackages                             cexll/hyperf-easywechat - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. cexll/hyperf-easywechat

AbandonedArchivedLibrary

cexll/hyperf-easywechat
=======================

Wechat SDK For Hyperf

v1.0.2(5y ago)132MITPHPPHP &gt;=7.3

Since Dec 29Pushed 5y ago1 watchersCompare

[ Source](https://github.com/cexll/hyperf-easywechat)[ Packagist](https://packagist.org/packages/cexll/hyperf-easywechat)[ RSS](/packages/cexll-hyperf-easywechat/feed)WikiDiscussions master Synced 6d ago

READMEChangelog (1)Dependencies (7)Versions (2)Used By (0)

Notice
======

[](#notice)

Swoole 4.6.0 开始已经支持协程Curl 所以这个项目没有继续维护的价值

如果是Swoole 4.6.0以下版本可以继续使用

hyperf-wechat
=============

[](#hyperf-wechat)

微信 SDK for Hyperf， 基于 overtrue/wechat

安装
--

[](#安装)

```
composer require cexll/hyperf-easywechat
```

配置
--

[](#配置)

1. 发布配置文件

```
php ./bin/hyperf.php vendor:publish cexll/hyperf-wechat
```

2. 修改应用根目录下的 `config/autoload/wechat.php` 中对应的参数即可。
3. 每个模块基本都支持多账号，默认为 `default`。

使用
--

[](#使用)

下面以接收普通消息为例写一个例子：

> 假设您的域名为 `nxx.cloud` 那么请登录微信公众平台 “开发者中心” 修改 “URL（服务器配置）” 为： `http://nxx.cloud/wechat`。

路由：

```
Router::addRoute(['GET', 'POST', 'HEAD'], '/wechat', 'App\Controller\WeChatController@serve');
```

> 注意：一定是 `Router::addRoute`, 因为微信服务端认证的时候是 `GET`, 接收用户消息时是 `POST` ！

然后创建控制器 `WeChatController`：

```
