Constants

GET

GET = 'get'

POST

POST = 'post'

JSON

JSON = 'json'

TICKET_CACHE_PREFIX

TICKET_CACHE_PREFIX = 'overtrue.wechat.jsapi_ticket.'

Ticket cache prefix.

API_TICKET

API_TICKET = 'https://api.weixin.qq.com/cgi-bin/ticket/getticket'

Api of ticket.

Properties

$maxRetries

$maxRetries : integer

Type

integer

$url

$url : string

Current URI.

Type

string

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

config()

config(array  $APIs, boolean  $debug = false, boolean  $beta = false, boolean  $json = true) : array|string

Get config json for jsapi.

Parameters

array $APIs
boolean $debug
boolean $beta
boolean $json

Returns

array|string

getConfigArray()

getConfigArray(array  $APIs, boolean  $debug = false, boolean  $beta = false) : array

Return jsapi config as a PHP array.

Parameters

array $APIs
boolean $debug
boolean $beta

Returns

array

ticket()

ticket(boolean  $forceRefresh = false) : string

Get jsticket.

Parameters

boolean $forceRefresh

Returns

string

signature()

signature(string  $url = null, string  $nonce = null, integer  $timestamp = null) : array

Build signature.

Parameters

string $url
string $nonce
integer $timestamp

Returns

array

getSignature()

getSignature(string  $ticket, string  $nonce, integer  $timestamp, string  $url) : string

Sign the params.

Parameters

string $ticket
string $nonce
integer $timestamp
string $url

Returns

string

setUrl()

setUrl(string  $url) : \EasyWeChat\Js\Js

Set current url.

Parameters

string $url

Returns

\EasyWeChat\Js\Js

getUrl()

getUrl() : string

Get current url.

Returns

string

setCache()

setCache(\Doctrine\Common\Cache\Cache  $cache) : $this

Set cache manager.

Parameters

\Doctrine\Common\Cache\Cache $cache

Returns

$this

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