1 Star 0 Fork 30

地球1号 / WeOpenDeveloper

forked from Anyon / WeOpenDeveloper 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

Latest Stable Version Latest Unstable Version Total Downloads License

WeOpenDeveloper

WeOpenDeveloper 为微信开放平台服务开发工具,基于 WeChatDeveloper 可对公众号进行管理。 更多功能可以参考下面的文档。

Documentation

PHP开发技术交流(QQ群 513350915)

PHP微信开发群 (SDK)

WeChatDeveloper 是基于官方接口封装,在做微信开发前,必需先阅读微信官方文档。

针对 WeChatDeveloper 也有一准备了帮助资料可供参考。

Repository

WeOpenDeveloper 为开源项目,允许把它用于任何地方,不受任何约束,欢迎 fork 项目。

更多开发可以参考项目 ThinkService 。 此项目已经实现对接,ThinkAdmin + ThinkService 组合。

Install

  • 通过 Composer 来管理安装
# 首次安装 线上版本(稳定)
composer require zoujingli/weopen-developer

# 首次安装 开发版本 
composer require zoujingli/weopen-developer dev-master

# 更新 WeChatDeveloper
composer update zoujingli/weopen-developer
  • 接口实例所需参数

// 配置参数(可以公众号服务平台获取)
$config = [
    'component_appid'          => 'wx4e63e993e222df8d',
    'component_token'          => 'P8QHTIxpBEq88IrxatqhgpBm2OAQROkI',
    'component_appsecret'      => '7cfa1afa87a41e2ea3445cea015c0974',
    'component_encodingaeskey' => 'L5uFIa0U6KLalPyXckyqoVIJYLhsfrg8k9YzybZIHsx',
];

// 注册授权公众号 AccessToken 处理
$config['GetAccessTokenCallback'] = function ($authorizer_appid) use ($config) {
    $open = new \WeOpen\Service($config);
    $authorizer_refresh_token = ''; // 通过$authorizer_appid从数据库去找吧,在授权绑定的时候获取
    $result = $open->refreshAccessToken($authorizer_appid, $authorizer_refresh_token);
    if (empty($result['authorizer_access_token'])) {
        throw new \WeChat\Exceptions\InvalidResponseException($result['errmsg'], '0');
    }
    $data = [
        'authorizer_access_token'  => $result['authorizer_access_token'],
        'authorizer_refresh_token' => $result['authorizer_refresh_token'],
    ];
    // 需要把$data记录到数据库
    return $result['authorizer_access_token'];
};
  • Ticket 接收处理

try{

    // 实例公众号服务接口
    $server = new \WeOpen\Service($config);
    
    // 获取并更新Ticket推送
    if (!($data = $server->getComonentTicket())) {
        return "Ticket event handling failed.";
    }
    
} catch (Exception $e) {

    // 出错啦,处理下吧
    echo $e->getMessage() . PHP_EOL;

}
  • 实例指定接口
try{

    // 实例公众号服务接口
    $open = new \WeOpen\Service($config);
    
    // 获取公众号接口操作实例
    $wechat = $open->instance('User', 'wx60a43dd8161666d4');
    
    // 获取公众号粉丝列表
    $list = $wechat->getUserList();
    var_export($list);
    
} catch (Exception $e) {

    // 出错啦,处理下吧
    echo $e->getMessage() . PHP_EOL;

}

Copyright

  • WeOpenDeveloper 基于MIT协议发布,任何人可以用在任何地方,不受约束
  • WeOpenDeveloper 部分代码来自互联网,若有异议,可以联系作者进行删除

Sponsor

赞助

MIT License Copyright (c) 2019 邹景立 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

微信开发工具包(开放平台) 展开 收起
PHP
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
PHP
1
https://gitee.com/lingsuch/WeOpenDeveloper.git
git@gitee.com:lingsuch/WeOpenDeveloper.git
lingsuch
WeOpenDeveloper
WeOpenDeveloper
master

搜索帮助

53164aa7 5694891 3bd8fe86 5694891