PHPackages                             wechat/wechat-sdk - 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. [Payment Processing](/categories/payments)
4. /
5. wechat/wechat-sdk

ActiveLibrary[Payment Processing](/categories/payments)

wechat/wechat-sdk
=================

WeChat platform and WeChat payment development tools

064PHP

Since Aug 27Pushed 7y agoCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

[![Latest Stable Version](https://camo.githubusercontent.com/4661eb7915351b1e78ab2a6d03e560481ff3df9a0431c7d5c6a908cec7591632/68747470733a2f2f706f7365722e707567782e6f72672f7a6f756a696e676c692f7765636861742d646576656c6f7065722f762f737461626c65)](https://packagist.org/packages/zoujingli/wechat-developer)[![Latest Unstable Version](https://camo.githubusercontent.com/2f4f69f286c03f6c8309f9207af4fa1baed277db954f7f7291d94eef78f893de/68747470733a2f2f706f7365722e707567782e6f72672f7a6f756a696e676c692f7765636861742d646576656c6f7065722f762f756e737461626c65)](https://packagist.org/packages/zoujingli/wechat-developer)[![Total Downloads](https://camo.githubusercontent.com/211f8ffc36542ce44524be0b8874d75bdaeb0fe08f6980c3da237318f8ef6d07/68747470733a2f2f706f7365722e707567782e6f72672f7a6f756a696e676c692f7765636861742d646576656c6f7065722f646f776e6c6f616473)](https://packagist.org/packages/zoujingli/wechat-developer)[![License](https://camo.githubusercontent.com/d8e1fdae598c6af61909d2ee7783d4f63baf2792610a191cb40cd484461fc1f6/68747470733a2f2f706f7365722e707567782e6f72672f7a6f756a696e676c692f7765636861742d646576656c6f7065722f6c6963656e7365)](https://packagist.org/packages/zoujingli/wechat-developer)

WeChatDeveloper for PHP
-----------------------

[](#wechatdeveloper-for-php)

- WeChatDeveloper 是基于 [wechat-php-sdk](https://github.com/zoujingli/wechat-php-sdk) 重构，优化并完善；
- 运行最底要求 PHP 版本 5.4 , 建议在 PHP7 上运行以获取最佳性能；
- WeChatDeveloper 针对 access\_token 失效增加了自动刷新机制；
- 微信的部分接口需要缓存数据在本地，因此对目录需要有写权限；
- 我们鼓励大家使用 composer 来管理您的第三方库，方便后期更新操作；
- WeChatDeveloper 已历经数个线上项目考验，欢迎 fork 或 star 此项目。

Documentation
-------------

[](#documentation)

PHP开发技术交流（QQ群 513350915）

[![PHP微信开发群 (SDK)](https://camo.githubusercontent.com/d8a86bc02a44a78d23d0746f300d73b0f9bb7e9a1f9eb6af61b2f159525f317d/687474703a2f2f7075622e69647171696d672e636f6d2f7770612f696d616765732f67726f75702e706e67)](http://shang.qq.com/wpa/qunwpa?idkey=ae25cf789dafbef62e50a980ffc31242f150bc61a61164458216dd98c411832a)

WeChatDeveloper 是基于官方接口封装，在做微信开发前，必需先阅读微信官方文档。

- 微信官方文档：
- 商户支付文档：

针对 WeChatDeveloper 也有一准备了帮助资料可供参考。

- ThinkAdmin：
- 开发文档地址：

Repositorie
-----------

[](#repositorie)

WeChatDeveloper 为开源项目，允许把它用于任何地方，不受任何约束，欢迎 fork 项目。

- Gitee 托管地址：
- GitHub 托管地址：

ClassMap
--------

[](#classmap)

文件名类名描述类型加载 ①Card.phpWeChat\\Card微信卡券接口支持认证服务号\\We::WeChatCard()Custom.phpWeChat\\Custom微信客服消息接口支持认证服务号\\We::WeChatCustom()Media.phpWeChat\\Media微信媒体素材接口支持认证服务号\\We::WeChatMedia()Oauth.phpWeChat\\Oauth微信网页授权消息类接口认证服务号\\We::WeChatOauth()Pay.phpWeChat\\Pay微信支付类接口认证服务号\\We::WeChatPay()Product.phpWeChat\\Product微信商店类接口认证服务号\\We::WeChatProduct()Qrcode.phpWeChat\\Qrcode微信二维码接口支持认证服务号\\We::WeChatQrcode()Receive.phpWeChat\\Receive微信推送事件消息处理支持认证服务号\\We::WeChatReceive()Scan.phpWeChat\\Scan微信扫一扫接口支持认证服务号\\We::WeChatScan()Script.phpWeChat\\Script微信前端JSSDK支持认证服务号\\We::WeChatScript()Shake.phpWeChat\\Shake微信蓝牙设备揺一揺接口认证服务号\\We::WeChatShake()Tags.phpWeChat\\Tags微信粉丝标签接口支持认证服务号\\We::WeChatTags()Template.phpWeChat\\Template微信模板消息接口支持认证服务号\\We::WeChatTemplate()User.phpWeChat\\User微信粉丝管理接口支持认证服务号\\We::WeChatCard()Wifi.phpWeChat\\Wifi微信门店WIFI管理支持认证服务号\\We::WeChatWifi()Bill.phpWePay\\Bill微信商户账单及评论微信支付\\We::WePayBill()Coupon.phpWePay\\Coupon微信商户代金券微信支付\\We::WePayCoupon()Order.phpWePay\\Order微信商户订单微信支付\\We::WePayOrder()Redpack.phpWePay\\Redpack微信红包支持微信支付\\We::WePayRedpack()Refund.phpWePay\\Refund微信商户退款微信支付\\We::WePayRefund()Transfers.phpWePay\\Transfers微信商户打款到零钱微信支付\\We::WePayTransfers()TransfersBank.phpWePay\\TransfersBank微信商户打款到银行卡微信支付\\We::WePayTransfersBank()Crypt.phpWeMini\\Crypt微信小程序数据加密处理微信小程序\\We::WeMiniCrypt()Plugs.phpWeMini\\Plugs微信小程序插件管理微信小程序\\We::WeMiniPlugs()Poi.phpWeMini\\Poi微信小程序地址管理微信小程序\\We::WeMiniPoi()Qrcode.phpWeMini\\Qrcode微信小程序二维码管理微信小程序\\We::WeMiniCrypt()Template.phpWeMini\\Template微信小程序模板消息支持微信小程序\\We::WeMiniTemplate()Total.phpWeMini\\Total微信小程序数据接口微信小程序\\We::WeMiniTotal()Install
-------

[](#install)

1.1 通过 Composer 来管理安装

```
# 首次安装 线上版本（稳定）
composer require zoujingli/wechat-developer

# 首次安装 开发版本（开发）
composer require zoujingli/wechat-developer dev-master

# 更新 WeChatDeveloper
composer update zoujingli/wechat-developer
```

1.2 如果不使用 Composer， 可以下载 WeChatDeveloper 并解压到项目中

```
# 在项目中加载初始化文件
include "您的目录/WeChatDeveloper/include.php";
```

2.1 接口实例所需参数

```
$config = [
    'token'          => 'test',
    'appid'          => 'wx60a43dd8161666d4',
    'appsecret'      => '71308e96a204296c57d7cd4b21b883e8',
    'encodingaeskey' => 'BJIUzE0gqlWy0GxfPp4J1oPTBmOrNDIGPNav1YFH5Z5',
    // 配置商户支付参数（可选，在使用支付功能时需要）
    'mch_id'         => "1235704602",
    'mch_key'        => 'IKI4kpHjU94ji3oqre5zYaQMwLHuZPmj',
    // 配置商户支付双向证书目录（可选，在使用退款|打款|红包时需要）
    'ssl_key'        => '',
    'ssl_cer'        => '',
    // 缓存目录配置（可选，需拥有读写权限）
    'cache_path'     => '',
];
```

3.1 实例指定接口

```
try {

    // 实例对应的接口对象
    $user = new \WeChat\User($config);

    // 调用接口对象方法
    $list = $user->getUserList();

    // 处理返回的结果
    echo '';
    var_export($list);

} catch (Exception $e) {

    // 出错啦，处理下吧
    echo $e->getMessage() . PHP_EOL;

}
```

Encapsulation
-------------

[](#encapsulation)

- 接入验证 （初级权限）
- 自动回复（文本、图片、语音、视频、音乐、图文） （初级权限）
- 菜单操作（查询、创建、删除） （菜单权限）
- 客服消息（文本、图片、语音、视频、音乐、图文） （认证权限）
- 二维码（创建临时、永久二维码，获取二维码URL） （服务号、认证权限）
- 长链接转短链接接口 （服务号、认证权限）
- 标签操作（查询、创建、修改、移动用户到标签） （认证权限）
- 网页授权（基本授权，用户信息授权） （服务号、认证权限）
- 用户信息（查询用户基本信息、获取关注者列表） （认证权限）
- 多客服功能（客服管理、获取客服记录、客服会话管理） （认证权限）
- 媒体文件（上传、获取） （认证权限）
- 高级群发 （认证权限）
- 模板消息（设置所属行业、添加模板、发送模板消息） （服务号、认证权限）
- 卡券管理（创建、修改、删除、发放、门店管理等） （认证权限）
- 语义理解 （服务号、认证权限）
- 获取微信服务器IP列表 （初级权限）
- 微信JSAPI授权(获取ticket、获取签名) （初级权限）
- 数据统计(用户、图文、消息、接口分析数据) （认证权限）
- 微信支付（网页支付、扫码支付、交易退款、给粉丝打款）（认证服务号并开通支付功能）

Permission
----------

[](#permission)

- 初级权限：基本权限，任何正常的公众号都有此权限
- 菜单权限：正常的服务号、认证后的订阅号拥有此权限
- 认证权限：分为订阅号、服务号认证，如前缀服务号则仅认证的服务号有此权限
- 支付权限：仅认证后的服务号可以申请此权限

Copyright
---------

[](#copyright)

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

Sponsor
-------

[](#sponsor)

[![赞助](https://camo.githubusercontent.com/bc5948d3bf2c065cfae52eec8b21ea9a61cde4d9a814471f1bad239c06b45e63/687474703a2f2f7a6f756a696e676c692e6f736368696e612e696f2f7374617469632f7061792e706e67)](https://camo.githubusercontent.com/bc5948d3bf2c065cfae52eec8b21ea9a61cde4d9a814471f1bad239c06b45e63/687474703a2f2f7a6f756a696e676c692e6f736368696e612e696f2f7374617469632f7061792e706e67)

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity40

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 50% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/34bdf84f86cc2a0ec26f7471a057d8abe6dde899f08a99e3c90cc05aa4425c2c?d=identicon)[todaybin](/maintainers/todaybin)

---

Top Contributors

[![raychancrypto](https://avatars.githubusercontent.com/u/82838909?v=4)](https://github.com/raychancrypto "raychancrypto (1 commits)")[![todaybin](https://avatars.githubusercontent.com/u/42737909?v=4)](https://github.com/todaybin "todaybin (1 commits)")

### Embed Badge

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

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

###  Alternatives

[omnipay/paypal

PayPal gateway for Omnipay payment processing library

3156.8M53](/packages/omnipay-paypal)[eduardokum/laravel-boleto

Biblioteca com boletos para o laravel

626351.9k2](/packages/eduardokum-laravel-boleto)[tbbc/money-bundle

This is a Symfony bundle that integrates moneyphp/money library (Fowler pattern): https://github.com/moneyphp/money.

1961.9M](/packages/tbbc-money-bundle)[2checkout/2checkout-php

2Checkout PHP Library

83740.3k2](/packages/2checkout-2checkout-php)[smhg/sepa-qr-data

Generate QR code data for SEPA payments

61717.2k5](/packages/smhg-sepa-qr-data)[omnipay/dummy

Dummy driver for the Omnipay payment processing library

271.2M33](/packages/omnipay-dummy)

PHPackages © 2026

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