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

ActiveLibrary[API Development](/categories/api)

evondu/wechat-php-sdk
=====================

0.1.2(6y ago)013PHP

Since Apr 12Pushed 6y agoCompare

[ Source](https://github.com/EvonDu/wechat-php-sdk)[ Packagist](https://packagist.org/packages/evondu/wechat-php-sdk)[ RSS](/packages/evondu-wechat-php-sdk/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (3)DependenciesVersions (4)Used By (0)

微信SDK简化版
========

[](#微信sdk简化版)

该项目根据微信支付的[开发文档](https://pay.weixin.qq.com/wiki/doc/api/index.html)重构微信的PHP-SDK，可以在项目中利用Composer简单的引入和使用，并适用于现在的各大PHP框架。

安装方法
====

[](#安装方法)

`$ composer require evondu/wechat-php-sdk`

简单示例
====

[](#简单示例)

这里以二维码支付为例，只用必填参数做调用（选填参数请参考[官方文档](https://pay.weixin.qq.com/wiki/doc/api/native.php?chapter=9_1)）

```
//引入Composer自动加载(例如YII等PHP框架则不需要，因为框架本身已经引入)
require '../vendor/autoload.php';
//引入类名空间
use evondu\wechat\WeChatClient;
use evondu\wechat\lib\Url;
//创建客户端
$config = include "config/qiyi.php";
$client = new WeChatClient([
    "app_id"        => "***************",
    "app_secret"    => "***************",
    "merchant_id"   => "***************",
    "key"           => "***************",
]);
//调用接口
$result = $client->payment->payNative([
    "body"          => "test",
    "out_trade_no"  => time(),
    "total_fee"     => 1,
],Url::to("notify.php"));

```

API
===

[](#api)

### 统一下单（NATIVE）

[](#统一下单native)

```
$result = $client->payment->payNative([
    "body"          => "test",
    "out_trade_no"  => time(),
    "total_fee"     => 1,
], "notify_url");

```

### 统一下单（JSAPI）

[](#统一下单jsapi)

```
$config = $client->payment->payJsapi([
    "body"          => "test",
    "out_trade_no"  => time(),
    "total_fee"     => 1,
    "openid"        => $openid
], "notify_url");

```

### 统一下单（H5支付）

[](#统一下单h5支付)

```
$result = $client->payment->payMweb([
    "body"          => "test",
    "out_trade_no"  => time(),
    "total_fee"     => 1,
    "scene_info"    => json_encode([])
], "notify_url");

```

### 申请微信免密支付扣费

[](#申请微信免密支付扣费)

```
$result = $client->pappay->apply([
    "body"          => "test",
    "out_trade_no"  => time(),
    "total_fee"     => 1,
    "contract_id"   => "***********"
], "notify_url");

```

### 查询微信免密支付签约关系

[](#查询微信免密支付签约关系)

```
$result = $client->pappay->queryContract([
    "contract_id"   => "***********"
]);

```

### 查询订单

[](#查询订单)

```
$result = $client->payment->query([
    "out_trade_no"  => "TEXT000001",
]);

```

### 申请退款

[](#申请退款)

```
$result = $client->payment->refund([
    "out_trade_no"  => "TEXT000001",
    "out_refund_no" => time(),
    "total_fee"     => 1,
    "refund_fee"    => 1,
]);

```

### 退款查询

[](#退款查询)

```
$result = $client->payment->refundQuery([
    "out_trade_no"  => "TEXT000001",
]);

```

通知（Notify）
==========

[](#通知notify)

- 获取通知数据：`$data = WeChatNotify::data();`
- 应答通知结果：`WeChatNotify::reply(true);`

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity52

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

Every ~61 days

Total

3

Last Release

2463d ago

### Community

Maintainers

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

---

Top Contributors

[![EvonDu](https://avatars.githubusercontent.com/u/26706325?v=4)](https://github.com/EvonDu "EvonDu (41 commits)")

### Embed Badge

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

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

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M271](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M454](/packages/google-gax)

PHPackages © 2026

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