PHPackages                             esd/wechat-plugin - 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. [DevOps &amp; Deployment](/categories/devops)
4. /
5. esd/wechat-plugin

ActiveLibrary[DevOps &amp; Deployment](/categories/devops)

esd/wechat-plugin
=================

wechat-plugin

0.1(6y ago)1181MITPHP

Since Jun 17Pushed 6y ago1 watchersCompare

[ Source](https://github.com/esd-projects/wechat-plugin)[ Packagist](https://packagist.org/packages/esd/wechat-plugin)[ RSS](/packages/esd-wechat-plugin/feed)WikiDiscussions master Synced 3d ago

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

ESD WeChat Plugin
=================

[](#esd-wechat-plugin)

ESD WeChat Plugin 是一个基于 Swoole 4.x 全协程支持的微信SDK库，告别同步阻塞，轻松编写高性能的微信公众号/小程序/开放平台业务接口

- EasySwooleDistributed WeChat 是基于 [EasySwoole WeChat](https://github.com/easy-swoole/wechat) 重构，优化并完善；

插件安装
----

[](#插件安装)

```
 composer require esd/wechat-plugin

```

添加 WeChatPlugin 插件
------------------

[](#添加-wechatplugin-插件)

```
 app/Application 的 main 中添加插件

 public static function main()
  {
    $application = new GoApplication();
    $application->addPlug(new WeChatPlugin());
    $application->run();
  }
```

配置参数
----

[](#配置参数)

在application-local.yml 中按需增加配置

```
wechat:
  official_account_config:  #公众号配置
    app_id: 111111111
    app_secret: 22222222222222222222
    ....
  mini_program_config:  #小程序配置
    app_id: 111111111
    app_secret: 22222222222222222222
  open_platform_config: #开放平台配置
    app_id: 111111111
    app_secret: 22222222222222222222
```

获取实例
----

[](#获取实例)

在开始操作之前需要获取一个实例，程序中使用以下方式获取实例

```
 use GetWeChat;
 //获取公众号实例
 $wechat = $this->getOfficialAccount();
```

异常捕获
----

[](#异常捕获)

在调用方法时，如果传递了无效的参数或者发生网络异常，将会抛出 ***ESD\\Plugins\\WeChat\\Exception\\RequestError*** 或者 ***ESD\\Plugins\\WeChat\\Exception\\OfficialAccountError*** 类型的异常，开发者需要手工捕获该类异常进行处理，类似这样：

```
use ESD\Plugins\WeChat\Exception\OfficialAccountError;
use ESD\Plugins\WeChat\Exception\RequestError;

 try {
   $list = $wechat->user()->list(); #获取粉丝列表
 } catch (RequestError $requestError){

 } catch (OfficialAccountError $error){

 }

```

其他
--

[](#其他)

> - 微信公众号沙箱:
> - 微信官方文档：
> - 开放平台文档：
> - 商户支付文档：

Copyright
---------

[](#copyright)

- ESD WeChat Plugin 基于`MIT`协议发布，任何人可以用在任何地方，不受约束
- ESD WeChat Plugin 部分代码来自互联网，若有异议，可以联系作者进行删除

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

2524d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a5215c2bd3cf9b92c98b26cab75d61770de01c51d7997aeb744f98e8100d4823?d=identicon)[SwooleDistributed](/maintainers/SwooleDistributed)

---

Top Contributors

[![lphkxd](https://avatars.githubusercontent.com/u/16346895?v=4)](https://github.com/lphkxd "lphkxd (3 commits)")

---

Tags

serverswoole

### Embed Badge

![Health badge](/badges/esd-wechat-plugin/health.svg)

```
[![Health](https://phpackages.com/badges/esd-wechat-plugin/health.svg)](https://phpackages.com/packages/esd-wechat-plugin)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
