PHPackages                             littlemo/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. [Utility &amp; Helpers](/categories/utility)
4. /
5. littlemo/wechat

ActiveProject[Utility &amp; Helpers](/categories/utility)

littlemo/wechat
===============

the littlemo wechat tools

v1.9.0(10mo ago)2107Apache-2.0PHPPHP ^7.0

Since Nov 13Pushed 10mo ago1 watchersCompare

[ Source](https://github.com/littlemolh/composer-wechat)[ Packagist](https://packagist.org/packages/littlemo/wechat)[ Docs](https://ggui.cn/)[ RSS](/packages/littlemo-wechat/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (10)Dependencies (2)Versions (36)Used By (0)

Wechat littlemo
===============

[](#wechat-littlemo)

[![Total Downloads](https://camo.githubusercontent.com/116621b189ead0d7edb0bd087abca7d37d4ef34940b72f9b924e6dd25451a680/68747470733a2f2f706f7365722e707567782e6f72672f6c6974746c656d6f2f7765636861742f646f776e6c6f616473)](https://packagist.org/packages/littlemo/wechat)[![Latest Stable Version](https://camo.githubusercontent.com/ca40f5a78fc49c6e53f811f02a693884a337a46c84459883ae7e7b08e486020f/68747470733a2f2f706f7365722e707567782e6f72672f6c6974746c656d6f2f7765636861742f762f737461626c65)](https://packagist.org/packages/littlemo/wechat)[![Latest Unstable Version](https://camo.githubusercontent.com/6760cfa42b76fd134b37e51af11db91aab77c487cb6af586184b2aafa35e2bd5/68747470733a2f2f706f7365722e707567782e6f72672f6c6974746c656d6f2f7765636861742f762f756e737461626c65)](https://packagist.org/packages/littlemo/wechat)[![PHP Version](https://camo.githubusercontent.com/21223b9ffedc1feec4026ec59947bafeec1e45b69a0e2fd1383975636e8d09a6/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344372e302d3838393242462e737667)](http://www.php.net/)[![License](https://camo.githubusercontent.com/57c0203052c3f1c482216e467d367fea0e630fdef52347b05892aee511466c01/68747470733a2f2f706f7365722e707567782e6f72672f6c6974746c656d6f2f7765636861742f6c6963656e7365)](https://packagist.org/packages/littlemo/wechat)

介绍
--

[](#介绍)

微信常用工具库

安装
--

[](#安装)

composer.json

```
{
    "require": {
        "littlemo/wechat": "1.8.*"
    }
}
```

```
composer require littlemo/wechat:"1.8.*"
```

使用
--

[](#使用)

#### 公共

[](#公共)

> 公共部分被所有方法继承，实例化任意类均可调用

```
use littlemo\wechat\Class;

$Class = new Class($appid , $secret, $mchid , $key , $certPath, $keyPath );
```

实例化参数

参数类型是否必填说明appidstringN应用ID(公众号appid/小程序appid/开放平台/第三方平台 appid)secretstringNappid对应的唯一凭证密钥(公众号secret/小程序secret/开放平台/第三方平台 secret)mchidstringN微信支付商户号keystringN微信支付商户号对应的支付密钥certPathstringN微信支付商户号api证书cert文件路径keyPathstringN微信支付商户号api证书key文件路径#### token

[](#token)

> 获取全局Access token（支持：公众号、小程序）

##### 示例代码

[](#示例代码)

```
use littlemo\wechat\Class;
use littlemo\wechat\core\LWechatException;

$Class = new Class($appid, $appkey);

$result = $Class->token();

if ($result) {
    echo '获取Access token成功';
    $token = $Class->getMessage();
} else {
    echo "获取Access token失败";
    $errorMsg = $Class->getErrorMsg();
}

try{
    $data = $Class->token()
}catch(LWechatException $e){
    print_r('错误代码：'.$e->getCode());
    print_r('错误提示：'.$e->getMessage());
    print_r('完整的内容：'.json_encode($e->getData()));
};

//查询完整的回调消息
$intactMsg = $Class->getIntactMsg();
```

**返回示例**

```
{
    "access_token":"ACCESS_TOKEN",
    "expires_in":7200
}
```

> [官方文档](https://developers.weixin.qq.com/doc/offiaccount/Basic_Information/Get_access_token.html)

### [公众号](https://github.com/littlemolh/composer-wechat/tree/main/src/gzh)

[](#公众号)

### 小程序

[](#小程序)

> 整理中...

### 开放平台

[](#开放平台)

> 整理中...

### 微信支付

[](#微信支付)

> 整理中...

参与贡献
----

[](#参与贡献)

1. littlemo

特技
--

[](#特技)

- 统一、精简

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance54

Moderate activity, may be stable

Popularity12

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 58.2% 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 ~40 days

Recently: every ~178 days

Total

35

Last Release

309d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/16798708?v=4)[25362583](/maintainers/25362583)[@25362583](https://github.com/25362583)

![](https://avatars.githubusercontent.com/u/43428262?v=4)[xiaowei95](/maintainers/xiaowei95)[@xiaowei95](https://github.com/xiaowei95)

---

Top Contributors

[![littlemolh](https://avatars.githubusercontent.com/u/26665792?v=4)](https://github.com/littlemolh "littlemolh (32 commits)")[![25362583](https://avatars.githubusercontent.com/u/16798708?v=4)](https://github.com/25362583 "25362583 (23 commits)")

---

Tags

toolutilswecahtlittlemo

### Embed Badge

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

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

###  Alternatives

[danielstjules/stringy

A string manipulation library with multibyte support

2.4k26.2M192](/packages/danielstjules-stringy)[phing/phing

PHing Is Not GNU make; it's a PHP project build system or build tool based on Apache Ant.

1.2k22.2M901](/packages/phing-phing)[bamarni/composer-bin-plugin

No conflicts for your bin dependencies

52823.6M1.0k](/packages/bamarni-composer-bin-plugin)[voku/arrayy

Array manipulation library for PHP, called Arrayy!

4885.6M18](/packages/voku-arrayy)[vaimo/composer-patches

Applies a patch from a local or remote file to any package that is part of a given composer project. Patches can be defined both on project and on package level. Optional support for patch versioning, sequencing, custom patch applier configuration and patch command for testing/troubleshooting added patches.

3014.5M22](/packages/vaimo-composer-patches)[voku/stringy

A string manipulation library with multibyte support

1793.9M24](/packages/voku-stringy)

PHPackages © 2026

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