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

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

topphp/topphp-wechat
====================

基于easywechat的微信组件

v1.0.1(5y ago)143MITPHPPHP ~7.2

Since Feb 17Pushed 5y ago1 watchersCompare

[ Source](https://github.com/topphp/topphp-wechat)[ Packagist](https://packagist.org/packages/topphp/topphp-wechat)[ RSS](/packages/topphp-topphp-wechat/feed)WikiDiscussions master Synced today

READMEChangelog (2)Dependencies (5)Versions (3)Used By (0)

topphp-wechat
=============

[](#topphp-wechat)

[![Latest Version on Packagist](https://camo.githubusercontent.com/e79a1d34a529068adb2f42b97a753234d130654334e4bf6081b5e11aa040f1db/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f746f707068702f746f707068702d7765636861742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/topphp/topphp-wechat)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/c05e3562892948306178a3b9c2ab0b298a6f8017b2e95347a8107efa3aadda03/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f746f707068702f746f707068702d7765636861742f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/topphp/topphp-wechat)[![Coverage Status](https://camo.githubusercontent.com/56e204a73c49afe2c7f60faed4bdb844e511abe95e34321c3262cecc0161f384/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f746f707068702f746f707068702d7765636861742e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/topphp/topphp-wechat/code-structure)[![Quality Score](https://camo.githubusercontent.com/bd3c6306d23b7230b35d5fb9cf97a3b572b723880d887ca877d1bb70d7001c47/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f746f707068702f746f707068702d7765636861742e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/topphp/topphp-wechat)[![Total Downloads](https://camo.githubusercontent.com/70b0068073984b115dbec1e03294b946b9a24af633331565ba386fae88ec870d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f746f707068702f746f707068702d7765636861742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/topphp/topphp-wechat)

> 基于easywechat封装的一个组件.使用方法和原始功能几乎一模一样,只是增加了swoole环境下的支持.加入了容器注入,在整个生命周期内为单例.

使用教程
====

[](#使用教程)

##### 1.入门

[](#1入门)

> 我们知道,使用`easywechat`时要先初始化,像这样:

```
$config = [
    'app_id' => 'wx3cf0f39249eb0exx',
    'secret' => 'f1c242f4f28f735d4687abb469072axx',
];
$app = Factory::officialAccount($config);
```

> 而在`topphp`中,已经进行了容器注入,所以在实例化时要这样写:

```
$wechat = $this->app->get(WeChat::class);
$config = $this->app->config->get('wechat');
$app = $wechat::officialAccount($config);

# 也可以这样用
$app = WeChat::officialAccount($config);
# 但是要注意,这样是多例模式
```

##### 2.组件安装后会在骨架工程的`config` 目录自动生成`wechat.php`文件,里面则是 `easywechat` 的配置参数

[](#2组件安装后会在骨架工程的config-目录自动生成wechatphp文件里面则是-easywechat-的配置参数)

#### 版本

[](#版本)

现代的PHP组件都使用语义版本方案(), 版本号由三个点(.)分数字组成(例如:1.13.2).第一个数字是主版本号,如果PHP组件更新破坏了向后兼容性,会提升主版本号. 第二个数字是次版本号,如果PHP组件小幅更新了功能,而且没有破坏向后兼容性,会提升次版本号. 第三个数字(即最后一个数字)是修订版本号,如果PHP组件修正了向后兼容的缺陷,会提升修订版本号.

Structure
---------

[](#structure)

> 组件结构

```
bin/
build/
docs/
config/
src/
tests/
vendor/

```

Install
-------

[](#install)

Via Composer

```
$ composer require topphp/topphp-wechat
```

Change log
----------

[](#change-log)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Testing
-------

[](#testing)

```
$ composer test
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) and [CODE\_OF\_CONDUCT](CODE_OF_CONDUCT.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [topphp](https://github.com/topphp)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

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 ~219 days

Total

2

Last Release

2053d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3774ddafd6cc1dbff3db41386611fac2236c095e12c9e99f1717da35ad792087?d=identicon)[topphp](/maintainers/topphp)

---

Top Contributors

[![go-sleep](https://avatars.githubusercontent.com/u/100214298?v=4)](https://github.com/go-sleep "go-sleep (3 commits)")

###  Code Quality

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

###  Alternatives

[topthink/think-captcha

captcha package for thinkphp

132934.4k67](/packages/topthink-think-captcha)[topthink/think-worker

workerman extend for thinkphp

202227.2k9](/packages/topthink-think-worker)[yunwuxin/think-cron

计划任务

17416.2k](/packages/yunwuxin-think-cron)[zzstudio/think-addons

The ThinkPHP6 Addons Package

1518.6k](/packages/zzstudio-think-addons)[topthink/think-annotation

Annotation For ThinkPHP

4831.5k8](/packages/topthink-think-annotation)[liliuwei/thinkphp-jump

适用于thinkphp6.0的跳转扩展

2874.4k1](/packages/liliuwei-thinkphp-jump)

PHPackages © 2026

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