Constants

GET

GET = 'get'

POST

POST = 'post'

JSON

JSON = 'json'

DAY

DAY = 86400

SCENE_MAX_VALUE

SCENE_MAX_VALUE = 100000

SCENE_QR_CARD

SCENE_QR_CARD = 'QR_CARD'

SCENE_QR_TEMPORARY

SCENE_QR_TEMPORARY = 'QR_SCENE'

SCENE_QR_TEMPORARY_STR

SCENE_QR_TEMPORARY_STR = 'QR_STR_SCENE'

SCENE_QR_FOREVER

SCENE_QR_FOREVER = 'QR_LIMIT_SCENE'

SCENE_QR_FOREVER_STR

SCENE_QR_FOREVER_STR = 'QR_LIMIT_STR_SCENE'

API_CREATE

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

API_SHOW

API_SHOW = 'https://mp.weixin.qq.com/cgi-bin/showqrcode'

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

Throws

\EasyWeChat\Core\Exceptions\HttpException

Returns

\EasyWeChat\Support\Collection

| null

forever()

forever(integer  $sceneValue) : \EasyWeChat\Support\Collection

Create forever.

Parameters

integer $sceneValue

Returns

\EasyWeChat\Support\Collection

temporary()

temporary(string  $sceneValue, null  $expireSeconds = null) : \EasyWeChat\Support\Collection

Create temporary.

Parameters

string $sceneValue
null $expireSeconds

Returns

\EasyWeChat\Support\Collection

card()

card(array  $card) : \EasyWeChat\Support\Collection

Create QRCode for card.

Parameters

array $card

{ "card_id": "pFS7Fjg8kV1IdDz01r4SQwMkuCKc", "code": "198374613512", "openid": "oFS7Fjl0WsZ9AMZqrI80nbIq8xrA", "expire_seconds": "1800", "is_unique_code": false , "outer_id" : 1 }

Returns

\EasyWeChat\Support\Collection

url()

url(string  $ticket) : string

Return url for ticket.

Parameters

string $ticket

Returns

string

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

create()

create(string  $actionName, array  $actionInfo, boolean  $temporary = true, integer  $expireSeconds = null) : \EasyWeChat\Support\Collection

Create a QRCode.

Parameters

string $actionName
array $actionInfo
boolean $temporary
integer $expireSeconds

Returns

\EasyWeChat\Support\Collection