PHPackages                             namesfang/wechat-token - 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. namesfang/wechat-token

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

namesfang/wechat-token
======================

微信公众号、小程序、开放平台获取AccessToken

1.0.0(5y ago)147MITPHPPHP &gt;=7.2

Since Jan 27Pushed 5y ago1 watchersCompare

[ Source](https://github.com/namesfang/wechat-token)[ Packagist](https://packagist.org/packages/namesfang/wechat-token)[ Docs](https://github.com/namesfang/wechat-token)[ RSS](/packages/namesfang-wechat-token/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependenciesVersions (2)Used By (0)

### 微信公众号、小程序、开放平台应用获取AccessToken

[](#微信公众号小程序开放平台应用获取accesstoken)

##### 获取token 示例

[](#获取token-示例)

```
use Namesfang\WeChat\Token\Log\Logger;
use Namesfang\WeChat\Token\Bundle\Option;
use Namesfang\WeChat\Token\Bundle\AccessToken;
// +-----------------------------------------------------------
// | 配置参数方式
// +-----------------------------------------------------------
$option = new Option('appid', 'secret');

// 也可以自行封装日志实现 LoggerInterface 即可
$logger = new Logger(LOG_PATH, true);

// 实例化发送类
$send = new AccessToken($option, $logger);

// 发送
$res = $send->request();

// 判断请求是否异常
if($res->error) {
    $logger->print($res->error, true);
}

// 打印接口返回的原始数据
$logger->print($res->original, true);

// 打印接口返回状态
$logger->print($res->access_token, true);

```

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity48

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

1975d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5258216?v=4)[堪笑](/maintainers/namesfang)[@namesfang](https://github.com/namesfang)

---

Top Contributors

[![namesfang](https://avatars.githubusercontent.com/u/5258216?v=4)](https://github.com/namesfang "namesfang (2 commits)")

---

Tags

accesstoken

### Embed Badge

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

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

###  Alternatives

[tractorcow/silverstripe-autocomplete

Autocomplete text field for Silverstripe

35392.6k6](/packages/tractorcow-silverstripe-autocomplete)[duncan3dc/bom-string

A small PHP library to handle byte order marks (BOM)

14565.5k2](/packages/duncan3dc-bom-string)[jucksearm/php-barcode

Barcode Generation Package inspired by Nicola Asuni.

11381.0k1](/packages/jucksearm-php-barcode)[datomatic/nova-detached-actions

A Laravel Nova tool to allow for placing actions in the Nova toolbar detached from the checkbox selection mechanism.

11258.1k](/packages/datomatic-nova-detached-actions)[zephir/kirby-cookieconsent

Kirby cookieconsent plugin

515.0k](/packages/zephir-kirby-cookieconsent)[runner/heshen

finite state machine

193.1k2](/packages/runner-heshen)

PHPackages © 2026

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