xin / wechat
基于EasyWechat封装的轻量版微信SDK,支持了小程序、公众号、开放平台、企业微信、企业微信三方平台等,针对微信每个类型的应用支持了多渠道管理与切换,可快速集成在Laravel和ThinkPHP项目中。
Installs: 11
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/xin/wechat
Requires
- w7corp/easywechat: ^6.7
- xin/capsule: ^1.0
- xin/support: ^1.0
This package is auto-updated.
Last update: 2025-12-29 06:49:41 UTC
README
介绍
基于Easywechat封装的轻量版微信SDK,支持了小程序、公众号、开放平台、企业微信、企业微信三方平台等,针对微信每个类型的应用支持了多渠道管理与切换
安装教程
composer require xin/wechat
使用说明
<?php <?php $config = [ 'defaults' => [ // 小程序默认配置 'mini_program' => 'default', // 公众号默认配置 'official_account' => 'default', // 微信开放平台默认配置 'open_platform' => 'default', // 企业微信默认配置 'work' => 'default', // 企业微信开放平台默认配置 'open_work' => 'default', /* * 日志配置 * * level: 日志级别,可选为:debug/info/notice/warning/error/critical/alert/emergency * file:日志文件位置(绝对路径!!!),要求可写权限 */ 'log' => [ 'level' => env('WECHAT_LOG_LEVEL', 'error'), 'file' => env('WECHAT_LOG_FILE', runtime_path('logs') . 'wechat.log'), ], ], // 小程序配置 'mini_program' => [ 'default' => [ 'app_id' => env('miniprogram.appid', ''), 'secret' => env('miniprogram.secret', ''), 'token' => env('miniprogram.token'), 'aes_key' => env('miniprogram.aes_key', ''), ], ], // 公众号配置 'official_account' => [ 'default' => [ 'app_id' => env('official_account.appid', ''), 'secret' => env('official_account.secret', ''), 'token' => env('official_account.token', ''), 'aes_key' => env('official_account.aes_key', ''), ], ], // 开放平台配置 'open_platform' => [ 'default' => [ 'app_id' => env('open_platform.appid', ''), 'secret' => env('open_platform.secret', ''), 'token' => env('open_platform.token', ''), 'aes_key' => env('open_platform.aes_key', ''), ], ], // 企业微信平台配置 'work' => [ // 默认应用配置 'default' => [ 'corp_id' => env('work.corpid', ''), 'agent_id' => env('work.agent_id', ''), 'secret' => env('work.secret', ''), 'token' => env('work.token', ''), 'aes_key' => env('work.aes_key', ''), ], // 通讯录配置 'contact' => [ 'corp_id' => env('work.contact_corpid', ''), 'secret' => env('work.contact_secret', ''), 'token' => env('work.contact_token', ''), 'aes_key' => env('work.contact_aes_key', ''), ], // 客户联系配置 'customer' => [ 'corp_id' => env('work.customer_corpid', ''), 'secret' => env('work.customer_secret', ''), 'token' => env('work.customer_token', ''), 'aes_key' => env('work.customer_aes_key', ''), ], ], // 企业微信开放平台配置 'open_work' => [ 'default' => [ 'corp_id' => env('open_work.corpid', ''), 'secret' => env('open_work.secret', ''), 'suite_id' => env('open_work.suite_id', ''), 'suite_secret' => env('open_work.suite_secret', ''), 'token' => env('open_work.token', ''), 'aes_key' => env('open_work.aes_key', ''), 'redirect_uri_install' => env('open_work.redirect_uri_install', ''), // 安装应用的回调url 'redirect_uri_single' => env('open_work.redirect_uri_single', ''), // 登录回调 'reg_template_id' => env('open_work.reg_template_id', ''), // 登录回调 ], ], ]; $manager= new Xin\Wechat\WechatManager($config); $manager->miniProgram()->auth->session($code);
参与贡献
- Fork 本仓库
- 新建 Feat_xxx 分支
- 提交代码
- 新建 Pull Request
码云特技
- 使用 Readme_XXX.md 来支持不同的语言,例如 Readme_en.md, Readme_zh.md