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

ActiveLibrary

xwzgit/my-wechat
================

study

1.0.2(8y ago)037MITPHPPHP ^5.6.0 || ^7.0

Since Dec 5Pushed 8y agoCompare

[ Source](https://github.com/xwzgit/my-wechat)[ Packagist](https://packagist.org/packages/xwzgit/my-wechat)[ Docs](https://codebowl.juhe.cn/groups/packages)[ RSS](/packages/xwzgit-my-wechat/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependencies (3)Versions (3)Used By (0)

微信公众号开发实践
=========

[](#微信公众号开发实践)

1、验证服务器消息
---------

[](#1验证服务器消息)

```
public function index(Request $request)
{
    $signature = $request->get('signature');
    $timestamp = $request->get('timestamp');
    $nonce = $request->get('nonce');

    $validate = new ValidateMsg();//初始化该验证类，调用验证方法即可

    if ($validate->validateToken($signature, $timestamp, $nonce, $token)) {
        return $request->get('echostr');
    } else {
        return '';
    }
}

```

2、消息处理
------

[](#2消息处理)

```
//初始化消息处理类：处理消息接收和解密操作（如果有密文）
$params = [
            'token' => config('wechatC.token'),
            'encodingAesKey' => config('wechatC.encodeKey'),
            'appid' => config('wechatC.appid'),
            'timestamp' => $request->input('timestamp',''),
            'nonce' => $request->input('nonce',''),
            'msgSignatur' => $request->input('msg_signature',''),
            'encryptType' => $request->input('encrypt_type',''),
        ];
$msgManage = new MessageManage($params);

//获取推送的原始消息体，如果是密文的话就是密文格式
$receipt = $msgManage->getSourceMessage()

//获取明文消息，数组格式数据
$message = $msgManage->getMessage();

//格式化成文本消息格式''
//$data内容根据实际消息类型而定
//文本['content']; link:[title,description,url];image:[media_id]
//vioce:[media_id]; video:[title,description,media_id]
//news: [[title,description,url,picurl]]
$content = $msgManage->textContent($data)

//格式化成微信服务器可识别的xml数据，如果推送的消息是加密的话，将返回加密密文格式
$response = $msg->convertResponseMessage($message, $MsgType, $contents)

```

3、加密解密
------

[](#3加密解密)

```
//使用openssl_encrypt()进行加密，因为php7.1废弃了mcrypt加密
//解密openssl_decrypt()解密
//具体参见PrpCrypt.php文件

```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 92% 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 ~6 days

Total

2

Last Release

3076d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8eaea22e75e1ebee47617e0085720b07829ebfbd14e865878eb1853ecdddacd0?d=identicon)[xwzgit](/maintainers/xwzgit)

---

Top Contributors

[![miya0315](https://avatars.githubusercontent.com/u/75360976?v=4)](https://github.com/miya0315 "miya0315 (23 commits)")[![jhapis](https://avatars.githubusercontent.com/u/204961774?v=4)](https://github.com/jhapis "jhapis (1 commits)")[![xwzgit](https://avatars.githubusercontent.com/u/34053770?v=4)](https://github.com/xwzgit "xwzgit (1 commits)")

---

Tags

wechatjuhe

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[overtrue/socialite

A collection of OAuth 2 packages.

1.4k5.5M87](/packages/overtrue-socialite)[thenbsp/wechat

微信公众平台第三方 SDK 开发包，优雅、健壮，可扩展，遵循 PSR 开发规范。

9408.2k](/packages/thenbsp-wechat)[chowjiawei/laravel-help-plugin

Integrating useful auxiliary functions into laravel,Assistant tools based on laravel.

671.6k](/packages/chowjiawei-laravel-help-plugin)[ymlluo/group-robot

钉钉、企业微信、飞书 自定义群组机器人。支持链式语法创建发送消息。支持文本、Markdown、图片、文件、图文、卡片等消息。

233.8k1](/packages/ymlluo-group-robot)

PHPackages © 2026

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