Constants

GET

GET = 'get'

POST

POST = 'post'

JSON

JSON = 'json'

API_CREATE

API_CREATE = 'https://api.weixin.qq.com/cgi-bin/menu/create'

API_GET

API_GET = 'https://api.weixin.qq.com/cgi-bin/menu/get'

API_DELETE

API_DELETE = 'https://api.weixin.qq.com/cgi-bin/menu/delete'

API_QUERY

API_QUERY = 'https://api.weixin.qq.com/cgi-bin/get_current_selfmenu_info'

API_CONDITIONAL_CREATE

API_CONDITIONAL_CREATE = 'https://api.weixin.qq.com/cgi-bin/menu/addconditional'

API_CONDITIONAL_DELETE

API_CONDITIONAL_DELETE = 'https://api.weixin.qq.com/cgi-bin/menu/delconditional'

API_CONDITIONAL_TEST

API_CONDITIONAL_TEST = 'https://api.weixin.qq.com/cgi-bin/menu/trymatch'

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

add()

add(array  $buttons, array  $matchRule = array()) : \EasyWeChat\Support\Collection

Add menu.

Parameters

array $buttons
array $matchRule

Returns

\EasyWeChat\Support\Collection

destroy()

destroy(integer  $menuId = null) : \EasyWeChat\Support\Collection

Destroy menu.

Parameters

integer $menuId

Returns

\EasyWeChat\Support\Collection

test()

test(string  $userId) : \EasyWeChat\Support\Collection

Test conditional menu.

Parameters

string $userId

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