Constants

GET

GET = 'get'

POST

POST = 'post'

JSON

JSON = 'json'

API_GET

API_GET = 'https://api.weixin.qq.com/cgi-bin/user/info'

API_BATCH_GET

API_BATCH_GET = 'https://api.weixin.qq.com/cgi-bin/user/info/batchget'

API_LIST

API_LIST = 'https://api.weixin.qq.com/cgi-bin/user/get'

API_GROUP

API_GROUP = 'https://api.weixin.qq.com/cgi-bin/groups/getid'

API_REMARK

API_REMARK = 'https://api.weixin.qq.com/cgi-bin/user/info/updateremark'

API_OAUTH_GET

API_OAUTH_GET = 'https://api.weixin.qq.com/sns/userinfo'

API_GET_BLACK_LIST

API_GET_BLACK_LIST = 'https://api.weixin.qq.com/cgi-bin/tags/members/getblacklist'

API_BATCH_BLACK_LIST

API_BATCH_BLACK_LIST = 'https://api.weixin.qq.com/cgi-bin/tags/members/batchblacklist'

API_BATCH_UNBLACK_LIST

API_BATCH_UNBLACK_LIST = 'https://api.weixin.qq.com/cgi-bin/tags/members/batchunblacklist'

Properties

$maxRetries

$maxRetries : integer

Type

integer

Methods

setHttp()

setHttp(\EasyWeChat\Core\Http  $http) : $this

Set the http instance.

Parameters

\EasyWeChat\Core\Http $http

Returns

$this

setAccessToken()

setAccessToken(\EasyWeChat\Core\AccessToken  $accessToken) : $this

Set the request token.

Parameters

\EasyWeChat\Core\AccessToken $accessToken

Returns

$this

maxRetries()

maxRetries(integer  $retries) 

Parameters

integer $retries

parseJSON()

parseJSON(string  $method, array  $args) : \EasyWeChat\Support\Collection

Parse JSON from response and check error.

Parameters

string $method
array $args

Returns

\EasyWeChat\Support\Collection

get()

get(string  $openId, string  $lang = 'zh_CN') : \EasyWeChat\Support\Collection

Fetch a user by open id.

Parameters

string $openId
string $lang

Returns

\EasyWeChat\Support\Collection

batchGet()

batchGet(array  $openIds, string  $lang = 'zh_CN') : \EasyWeChat\Support\Collection

Batch get users.

Parameters

array $openIds
string $lang

Returns

\EasyWeChat\Support\Collection

lists()

lists(string  $nextOpenId = null) : \EasyWeChat\Support\Collection

List users.

Parameters

string $nextOpenId

Returns

\EasyWeChat\Support\Collection

remark()

remark(string  $openId, string  $remark) : \EasyWeChat\Support\Collection

Set user remark.

Parameters

string $openId
string $remark

Returns

\EasyWeChat\Support\Collection

group()

group(string  $openId) : \EasyWeChat\Support\Collection

Get user's group id.

Parameters

string $openId

Returns

\EasyWeChat\Support\Collection

getGroup()

getGroup(string  $openId) : \EasyWeChat\Support\Collection

Get user's group.

Parameters

string $openId

Returns

\EasyWeChat\Support\Collection

blacklist()

blacklist(string|null  $beginOpenid = null) : \EasyWeChat\Support\Collection

Get black list.

Parameters

string|null $beginOpenid

Returns

\EasyWeChat\Support\Collection

batchBlock()

batchBlock(array  $openidList) : \EasyWeChat\Support\Collection

Batch block user.

Parameters

array $openidList

Returns

\EasyWeChat\Support\Collection

batchUnblock()

batchUnblock(array  $openidList) : \EasyWeChat\Support\Collection

Batch unblock user.

Parameters

array $openidList

Returns

\EasyWeChat\Support\Collection

registerHttpMiddlewares()

registerHttpMiddlewares() 

Register Guzzle middlewares.

accessTokenMiddleware()

accessTokenMiddleware() : \Closure

Attache access token to request query.

Returns

\Closure

logMiddleware()

logMiddleware() : \Closure

Log the request.

Returns

\Closure

retryMiddleware()

retryMiddleware() : \Closure

Return retry middleware.

Returns

\Closure

checkAndThrow()

checkAndThrow(array  $contents) 

Check the array data errors, and Throw exception when the contents contains error.

Parameters

array $contents

Throws

\EasyWeChat\Core\Exceptions\HttpException