Constants

SUCCESS_EMPTY_RESPONSE

SUCCESS_EMPTY_RESPONSE = 'success'

Empty string.

TEXT_MSG

TEXT_MSG = 2

IMAGE_MSG

IMAGE_MSG = 4

VOICE_MSG

VOICE_MSG = 8

VIDEO_MSG

VIDEO_MSG = 16

SHORT_VIDEO_MSG

SHORT_VIDEO_MSG = 32

LOCATION_MSG

LOCATION_MSG = 64

DEVICE_EVENT_MSG

DEVICE_EVENT_MSG = 256

DEVICE_TEXT_MSG

DEVICE_TEXT_MSG = 512

FILE_MSG

FILE_MSG = 1024

EVENT_MSG

EVENT_MSG = 1048576

ALL_MSG

ALL_MSG = 1049598

Properties

$token

$token : string

Type

string

$messageHandler

$messageHandler : string|callable

Type

string|callable

$messageFilter

$messageFilter : integer

Type

integer

$messageTypeMapping

$messageTypeMapping : array

Type

array

$debug

$debug : boolean

Type

boolean

Methods

debug()

debug(boolean  $debug = true) : $this

Enable/Disable debug mode.

Parameters

boolean $debug

Returns

$this

validate()

validate(string  $token) 

Validation request params.

Parameters

string $token

Throws

\EasyWeChat\Core\Exceptions\FaultException

setMessageHandler()

setMessageHandler(callable  $callback = null, integer  $option = self::ALL_MSG) : \EasyWeChat\Server\Guard

Add a event listener.

Parameters

callable $callback
integer $option

Throws

\EasyWeChat\Core\Exceptions\InvalidArgumentException

Returns

\EasyWeChat\Server\Guard

getMessageHandler()

getMessageHandler() : string

Return the message listener.

Returns

string

getMessage()

getMessage() : array

Get request message.

Throws

\EasyWeChat\Server\BadRequestException

Returns

array

buildResponse()

buildResponse(  $to,   $from, mixed  $message) : string

Build response.

Parameters

$to
$from
mixed $message

Throws

\EasyWeChat\Core\Exceptions\InvalidArgumentException

Returns

string

isMessage()

isMessage(mixed  $message) : boolean

Whether response is message.

Parameters

mixed $message

Returns

boolean

handleRequest()

handleRequest() : array

Handle request.

Throws

\EasyWeChat\Core\Exceptions\RuntimeException
\EasyWeChat\Server\BadRequestException

Returns

array

handleMessage()

handleMessage(array  $message) : mixed

Handle message.

Parameters

array $message

Returns

mixed

buildReply()

buildReply(string  $to, string  $from, \EasyWeChat\Message\AbstractMessage  $message) : string

Build reply XML.

Parameters

string $to
string $from
\EasyWeChat\Message\AbstractMessage $message

Returns

string

signature()

signature(array  $request) : string

Get signature.

Parameters

array $request

Returns

string

parseMessageFromRequest()

parseMessageFromRequest(string|resource  $content) : array

Parse message array from raw php input.

Parameters

string|resource $content

Throws

\EasyWeChat\Core\Exceptions\RuntimeException
\EasyWeChat\Encryption\EncryptionException

Returns

array

isSafeMode()

isSafeMode() : boolean

Check the request message safe mode.

Returns

boolean