{"id":22740552,"url":"https://github.com/larvatecn/think-wechat","last_synced_at":"2025-10-09T10:42:18.713Z","repository":{"id":57012537,"uuid":"378058940","full_name":"larvatecn/think-wechat","owner":"larvatecn","description":null,"archived":false,"fork":false,"pushed_at":"2022-01-22T17:16:42.000Z","size":14,"stargazers_count":1,"open_issues_count":0,"forks_count":2,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-09-02T01:29:40.858Z","etag":null,"topics":["thinkphp","thinkphp6","wechat","weixin"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/larvatecn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-06-18T06:43:55.000Z","updated_at":"2022-04-05T01:46:28.000Z","dependencies_parsed_at":"2022-08-21T13:40:49.920Z","dependency_job_id":null,"html_url":"https://github.com/larvatecn/think-wechat","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/larvatecn/think-wechat","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/larvatecn%2Fthink-wechat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/larvatecn%2Fthink-wechat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/larvatecn%2Fthink-wechat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/larvatecn%2Fthink-wechat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/larvatecn","download_url":"https://codeload.github.com/larvatecn/think-wechat/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/larvatecn%2Fthink-wechat/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279001274,"owners_count":26083040,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-09T02:00:07.460Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["thinkphp","thinkphp6","wechat","weixin"],"created_at":"2024-12-10T23:09:21.627Z","updated_at":"2025-10-09T10:42:18.681Z","avatar_url":"https://github.com/larvatecn.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# think-wechat\n\n微信 SDK For ThinkPHP 6.0 基于[overtrue/wechat](https://github.com/overtrue/wechat)\n\n## 框架要求\n\nThinkPHP6.0(中间件要求支持 ThinkPH6.0+)\n\n## 安装\n\n```\ncomposer require larva/think-wechat -vv\n```\n\n## 配置\n\n1. 修改配置文件\n   修改项目根目录下 config/wechat.php 中对应的参数\n\n2. 每个模块基本都支持多账号，默认为 default。\n\n## 使用\n\n### 接受普通消息\n\n新建一个 Controller，我这边用的是 Wechat\n\n```php\n\u003c?php\n\nnamespace app\\controller;\n\nuse think\\Controller;\n\nclass Wechat extends Controller\n{\n\n    public function index()\n    {\n        //    先初始化微信\n        $app = app('wechat.official_account');\n        $app-\u003eserver-\u003epush(function($message){\n            return 'hello,world';\n        });\n        $app-\u003eserver-\u003eserve()-\u003esend();\n    }\n}\n```\n\n#### 获得 SDK 实例 使用 Facade\n\n```php\nuse Larva\\Wechat\\Wechat;\n\n$officialAccount = Wechat::officialAccount();  // 公众号\n$work = Wechat::work(); // 企业微信\n$payment = Wechat::payment(); // 微信支付\n$openPlatform = Wechat::openPlatform(); // 开放平台\n$miniProgram = Wechat::miniProgram(); // 小程序\n$openWork = Wechat::openWork(); // 企业微信第三方服务商\n$microMerchant = Wechat::microMerchant(); // 小微商户\n```\n\n以上均支持传入自定义账号:例如\n\n```php\n$officialAccount = Wechat::officialAccount('test'); // 公众号\n```\n\n更多 SDK 的具体使用请参考：https://easywechat.com\n\n#### 中间件参数说明\n\n由于ThinkPHP中间件只支持一个参数，所以以:做分割\n\n支持传入account账号别名以及scope类型\n\n若不传入account，会使用default账号\n\n若不传入scope，会使用配置文件中的oauth.scope\n\n支持一下两种方式\n\ndefault:snsapi_base\nsnsapi_base\n\n## 参考项目\n\n-   [overtrue/laravel-wechat](https://github.com/overtrue/laravel-wechat)\n-   [naixiaoxin/think-wechat](https://github.com/naixiaoxin/think-wechat)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flarvatecn%2Fthink-wechat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flarvatecn%2Fthink-wechat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flarvatecn%2Fthink-wechat/lists"}