Constants

GET

GET = 'get'

POST

POST = 'post'

JSON

JSON = 'json'

CREATE_PRE_AUTH_CODE

CREATE_PRE_AUTH_CODE = 'https://api.weixin.qq.com/cgi-bin/component/api_create_preauthcode'

Create pre auth code url.

Properties

$maxRetries

$maxRetries : integer

Type

integer

Methods

getAppId()

getAppId() : string

Get OpenPlatform AppId.

Returns

string

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

getCode()

getCode() : string

Get pre auth code.

Throws

\EasyWeChat\Core\Exceptions\InvalidArgumentException

Returns

string

redirect()

redirect(string  $url, string  $preAuthCode = null) : \Symfony\Component\HttpFoundation\RedirectResponse

Redirect to WeChat PreAuthorization page.

Parameters

string $url
string $preAuthCode

Returns

\Symfony\Component\HttpFoundation\RedirectResponse

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