PHPackages                             nanxihang/wechat - 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. [API Development](/categories/api)
4. /
5. nanxihang/wechat

ActiveLibrary[API Development](/categories/api)

nanxihang/wechat
================

WeChat SDK Library for PHP

v1.0.1(4mo ago)00MITPHPPHP &gt;=5.6.0

Since Dec 31Pushed 4mo agoCompare

[ Source](https://github.com/yynonline/nxh-wechat)[ Packagist](https://packagist.org/packages/nanxihang/wechat)[ Docs](https://github.com/yynonline/nxh-wechat)[ RSS](/packages/nanxihang-wechat/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (1)Versions (3)Used By (0)

WeChat SDK for PHP
==================

[](#wechat-sdk-for-php)

[![Latest Stable Version](https://camo.githubusercontent.com/f2b4385b3198ced60aa6fa53162ff178973fecaa4c16e3bed3ff85ef7a7a2590/68747470733a2f2f706f7365722e707567782e6f72672f6e616e786968616e672f7765636861742f762f737461626c65)](https://packagist.org/packages/nanxihang/wechat)[![Total Downloads](https://camo.githubusercontent.com/7a9076a61f43c2310a1066ef78eb9a68dee6b938897dcf7fb685996e378f68b9/68747470733a2f2f706f7365722e707567782e6f72672f6e616e786968616e672f7765636861742f646f776e6c6f616473)](https://packagist.org/packages/nanxihang/wechat)[![License](https://camo.githubusercontent.com/756e1c19e97c95fcd6a8d8942cb37e919898a4051937f7d1dba9652886d6bf6c/68747470733a2f2f706f7365722e707567782e6f72672f6e616e786968616e672f7765636861742f6c6963656e7365)](https://packagist.org/packages/nanxihang/wechat)

一个功能完整的微信SDK，支持微信公众平台、企业微信和微信支付功能。

功能特性
----

[](#功能特性)

- ✅ 公众号消息接收与回复
- ✅ OAuth2.0网页授权
- ✅ JSSDK支持
- ✅ 自定义菜单管理
- ✅ 模板消息推送
- ✅ 企业微信支持
- ✅ 微信支付（JSAPI、扫码、APP支付）
- ✅ 消息加解密
- ✅ 素材管理
- ✅ 用户管理
- ✅ 数据统计

环境要求
----

[](#环境要求)

- PHP &gt;= 5.6.0
- cURL扩展
- OpenSSL扩展
- SimpleXML扩展
- JSON扩展

安装
--

[](#安装)

使用Composer安装：

```
composer require nanxihang/wechat ^1.0.1
```

快速开始
----

[](#快速开始)

错误码说明
-----

[](#错误码说明)

SDK提供了完整的错误码常量：

```
use Nanxihang\Wechat\ErrCode;

echo ErrCode::$OK; // 0
echo ErrCode::$ERROR_SYSTEM; // 90001
```

企业微信错误码：

```
use Nanxihang\Wechat\QyErrCode;

echo QyErrCode::$OK; // 0
echo QyErrCode::$ERROR_INVALID_APPID; // 40013
```

目录结构
----

[](#目录结构)

```
src/
├── Internal/
│   ├── ErrorCode.php          # 错误码定义
│   ├── PKCS7Encoder.php       # PKCS7编码器
│   ├── Prpcrypt.php           # 加密解密类
│   └── QyErrorCode.php        # 企业微信错误码
├── errCode.php               # 公众号错误码常量
├── qyerrCode.php             # 企业微信错误码常量
└── WechatX.php              # 主SDK类
tests/
├── bootstrap.php            # 测试引导文件
├── WechatTest.php          # 主类测试
└── phpunit.xml             # PHPUnit配置
examples/
├── basic_usage.php         # 基础使用示例
├── corp_usage.php          # 企业微信示例
└── payment_usage.php       # 支付示例

```

版本历史
----

[](#版本历史)

查看 [CHANGELOG.md](CHANGELOG.md) 文件了解版本更新详情。

许可证
---

[](#许可证)

MIT License

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance75

Regular maintenance activity

Popularity0

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity31

Early-stage or recently created project

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

Every ~3 days

Total

2

Last Release

135d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/657a6cbb9aeb53ce42dc347a9ae7ba6bc2fa605e924de3fbcf9a72fb0633cfef?d=identicon)[hubudong](/maintainers/hubudong)

---

Tags

apisdkwechatweixin

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

PHPackages © 2026

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