Constants

GET

GET = 'get'

POST

POST = 'post'

JSON

JSON = 'json'

API_GET_WXACODE

API_GET_WXACODE = 'https://api.weixin.qq.com/wxa/getwxacode'

API_GET_WXACODE_UNLIMIT

API_GET_WXACODE_UNLIMIT = 'https://api.weixin.qq.com/wxa/getwxacodeunlimit'

API_CREATE_QRCODE

API_CREATE_QRCODE = 'https://api.weixin.qq.com/cgi-bin/wxaapp/createwxaqrcode'

Properties

$config

$config : array

Mini program config.

Type

array

$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

getAppCode()

getAppCode(string  $path, integer  $width = 430, boolean  $autoColor = false, array  $lineColor = array('r' => 0, 'g' => 0, 'b' => 0)) : \Psr\Http\Message\StreamInterface

Get WXACode.

Parameters

string $path
integer $width
boolean $autoColor
array $lineColor

Returns

\Psr\Http\Message\StreamInterface

getAppCodeUnlimit()

getAppCodeUnlimit(string  $scene, integer  $width = 430, boolean  $autoColor = false, array  $lineColor = array('r' => 0, 'g' => 0, 'b' => 0)) : \Psr\Http\Message\StreamInterface

Get WXACode unlimit.

Parameters

string $scene
integer $width
boolean $autoColor
array $lineColor

Returns

\Psr\Http\Message\StreamInterface

appCodeUnlimit()

appCodeUnlimit(string  $scene, string  $page = null, integer  $width = null, boolean  $autoColor = null, array  $lineColor = null) : \Psr\Http\Message\StreamInterface

Get app code unlimit.

Parameters

string $scene
string $page
integer $width
boolean $autoColor
array $lineColor

Returns

\Psr\Http\Message\StreamInterface

createQRCode()

createQRCode(string  $path, integer  $width = 430) : \Psr\Http\Message\StreamInterface

Create QRCode.

Parameters

string $path
integer $width

Returns

\Psr\Http\Message\StreamInterface

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

getStream()

getStream(string  $endpoint, array  $params) : \Psr\Http\Message\StreamInterface

Get stream.

Parameters

string $endpoint
array $params

Returns

\Psr\Http\Message\StreamInterface