jean553/wechat-bundle
最新稳定版本:v0.5.0
Composer 安装命令:
composer require jean553/wechat-bundle
包简介
Wechat authentication/profile management bundle
README 文档
README
MIT License
WechatBundle
PHP Bundle for WeChat. By developing applications, it is often required to call WeChat services ( like get all connected user information, authorize an user to connect... etc... ). The goal of this bundle is to group them all.
The latest version of the bundle can handle :
- get all the necessary token for both of Oauth2 and Wechat JS API communication
- authorize an user to connect by checking Wechat account
- get current connected user WeChat information ( nichname, location, image... )
Note : if you want be able to handle WeChat wall/friends sharing features, please use my other JavaScript project WechatJS with the current bundle.
Note : bundle development ongoing tasks are all availables in this Github issues section.
Installation
The latest version of the bundle can be downloaded through Composer :
"require": {
"jean553/wechat-bundle": "dev-master"
}
Use
Use the bundle in your project :
use jean553\WechatBundle\Services\WechatService;
Connect to the WeChat authentication service OAuth2. Use your application id ( appid ) and secret passphrase ( secret ) available on your WeChat Public Account ( https://mp.weixin.qq.com/ ).
$wechatService = new WechatService();
$authentication = $wechatService->authorize(
$appid,
$secret
);
if(!$authentication) {
return new Response('WeChat connection error.');
}
Get the current user information.
$user = $wechatService->getUserInformation();
$user is an array which contains the following items :
- openid : user WeChat openid
- nickname : WeChat nickname of the user
- sex
- language
- city
- province
- country
- headimgurl : absolute path of the user profile picture
- privilege
Run the tests
bin/phpunit jean553/WechatBundle
统计信息
- 总下载量: 49
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-04-17