tourze/wechat-mini-program-plugin-bundle
最新稳定版本:0.1.0
Composer 安装命令:
composer require tourze/wechat-mini-program-plugin-bundle
包简介
微信小程序插件
README 文档
README
A Symfony bundle for WeChat Mini Program plugin request signature verification.
Installation
Install the package via Composer:
composer require tourze/wechat-mini-program-plugin-bundle
Quick Start
- Add the bundle to your
config/bundles.php:
<?php return [ // ... other bundles WechatMiniProgramPluginBundle\WechatMiniProgramPluginBundle::class => ['all' => true], ];
- The bundle will automatically register the
HostSignCheckSubscriberto verify WeChat Mini Program plugin requests.
Features
- Request Signature Verification: Automatically validates
X-WECHAT-HOSTSIGNheader - AppID Extraction: Extracts AppID from referrer URL
- Security: Ensures request authenticity using SHA1 signature verification
- Logging: Comprehensive logging for debugging and monitoring
Usage
The bundle automatically handles WeChat Mini Program plugin request verification through the HostSignCheckSubscriber. When a request contains the X-WECHAT-HOSTSIGN header, the subscriber will:
- Extract the signature data from the header
- Parse the AppID from the referrer URL
- Verify the signature using the configured plugin token
- Throw an exception if the signature is invalid
Example Request Headers
X-WECHAT-HOSTSIGN: {"noncestr":"RANDOM_STRING", "timestamp":"1234567890", "signature":"SHA1_SIGNATURE"}
Referrer: https://servicewechat.com/wx1234567890abcdef/1/page-frame.html
Configuration
The bundle requires the tourze/wechat-mini-program-bundle package to be properly configured with WeChat Mini Program accounts and plugin tokens.
License
This project is licensed under the MIT License - see the LICENSE file for details.
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-11-10