{"id":15686195,"url":"https://github.com/buptlsp/yii2-wechat","last_synced_at":"2026-04-06T04:32:32.727Z","repository":{"id":53692615,"uuid":"185902948","full_name":"buptlsp/yii2-wechat","owner":"buptlsp","description":"微信各种开发的封装","archived":false,"fork":false,"pushed_at":"2021-03-19T06:53:06.000Z","size":957,"stargazers_count":9,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-11-03T20:18:53.229Z","etag":null,"topics":["smallapp","wechat","yii2","yii2-extension"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/buptlsp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-05-10T02:16:15.000Z","updated_at":"2023-08-21T01:45:37.000Z","dependencies_parsed_at":"2022-09-05T06:01:10.443Z","dependency_job_id":null,"html_url":"https://github.com/buptlsp/yii2-wechat","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/buptlsp/yii2-wechat","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/buptlsp%2Fyii2-wechat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/buptlsp%2Fyii2-wechat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/buptlsp%2Fyii2-wechat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/buptlsp%2Fyii2-wechat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/buptlsp","download_url":"https://codeload.github.com/buptlsp/yii2-wechat/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/buptlsp%2Fyii2-wechat/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31460102,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-05T21:22:52.476Z","status":"online","status_checked_at":"2026-04-06T02:00:07.287Z","response_time":112,"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":["smallapp","wechat","yii2","yii2-extension"],"created_at":"2024-10-03T17:35:39.651Z","updated_at":"2026-04-06T04:32:32.712Z","avatar_url":"https://github.com/buptlsp.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# yii2-wechat\n\n\n## 环境条件\n\n- php5.4或更高\n- Yii2\n\n\n## 安装\n\n您可以使用composer来安装, 添加下列代码在您的``composer.json``文件中并执行``composer update``操作\n\n```json\n{\n    \"require\": {\n       \"lspbupt/yii2-wechat\": \"dev-master\"\n    }\n}\n```\n或者\n```\ncomposer require lspbupt/yii2-wechat dev-master\n```\n## 主要功能\n\n在正常的业务开发过程中，和微信的对接是一个极为繁琐的事情，本软件力求将微信的对接封装起来，对外提供一个方便，舒适的开发过程，尽力降低与微信对接的难度。目前主要实现了如下内容：\n\n - [微信公众号对接][1]\n - [微信h5支付对接][2]\n - [微信小程序对接][5]\n \n - [外部网站微信内登录对接][3]\n - [外部网站微信扫码登录对接][4]\n\n## 大致说明\n\n### 后端对接\n所有与微信后端对接的接口的使用，大致的流程均是一样的过程, 具体的可以参见前文中相应的链接：\n\n1.注入component, 这个component是我们跟微信的桥梁，\n\n```php\n    return [\n        'component' =\u003e [\n            // ...\n            'wechat' =\u003e [\n                'class' =\u003e 'xxx', // 具体对接的类，如：ethercap/Wechat::class,\n                'appid' =\u003e 'xxx',\n                'appsecret' =\u003e 'xxx',\n            ],\n            //  其它配置\n        ],\n    ];\n```\n2.上面的配置好之后，就可以直接通过如下实例请求微信接口了。\n```php\n$ret = Yii::$app-\u003ewechat-\u003ehttpExec('xxx', []);\n```\n在请求发起时，会自动从cache中读取access_token，并发出请求。如果cache中不存在，会通过微信的接口，获取access_token。用户完全不需要关心微信access_token的事情，也不需要关心加密的问题。\n\n    \n### 前端对接\n所有与微信前端对接，大致的流程也均是一样的,我们只需要在前端的页面上放入如下的内容就能完全前端的对接，不需要繁琐的jsapi计算：\n```php\n// 具体的类详见上文中具体对接的文档\necho JSxxxConfig:: widget([\n    'debug' =\u003e false, //true代表打开前端调试\n    'wechat' =\u003e 'wechat', //具体的实例，对应上一节的配置名，默认为wechat\n    'successJs' =\u003e 'function(){console.log(\"success\")}', //js校验成功时的回调\n    'errorJs' =\u003e 'function(){console.log(\"error\")}', //js校验失败时的回调\n    'jsApiList' =\u003e [], //需要在本页中调用的js接口\n]);\n```\n\n\n## 广告\n我们是一群热爱技术，追求卓越的极客，我们乐于做一些对整个社会都有作用的事情，我们希望通过我们的努力来推动整个社会的创新，如果你也一样，欢迎加入我们（service@ethercap.com）！你也可以通过https://tech.ethercap.com 来了解更多！\n\n\n\n[1]: docs/Wechat.md\n[2]: docs/WxPay.md\n[3]: docs/WxLogin.md\n[4]: docs/WxApp.md\n[5]: docs/WxSmallApp.md\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbuptlsp%2Fyii2-wechat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbuptlsp%2Fyii2-wechat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbuptlsp%2Fyii2-wechat/lists"}