Constants

GET

GET = 'get'

POST

POST = 'post'

JSON

JSON = 'json'

API_SEND_BY_GROUP

API_SEND_BY_GROUP = 'https://api.weixin.qq.com/cgi-bin/message/mass/sendall'

API_SEND_BY_OPENID

API_SEND_BY_OPENID = 'https://api.weixin.qq.com/cgi-bin/message/mass/send'

API_DELETE

API_DELETE = 'https://api.weixin.qq.com/cgi-bin/message/mass/delete'

API_PREVIEW

API_PREVIEW = 'https://api.weixin.qq.com/cgi-bin/message/mass/preview'

API_GET

API_GET = 'https://api.weixin.qq.com/cgi-bin/message/mass/get'

PREVIEW_BY_OPENID

PREVIEW_BY_OPENID = 'touser'

PREVIEW_BY_NAME

PREVIEW_BY_NAME = 'towxname'

MSG_TYPE_TEXT

MSG_TYPE_TEXT = 'text'

MSG_TYPE_NEWS

MSG_TYPE_NEWS = 'news'

MSG_TYPE_VOICE

MSG_TYPE_VOICE = 'voice'

MSG_TYPE_IMAGE

MSG_TYPE_IMAGE = 'image'

MSG_TYPE_VIDEO

MSG_TYPE_VIDEO = 'video'

MSG_TYPE_CARD

MSG_TYPE_CARD = 'card'

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

send()

send(string  $msgType, mixed  $message, mixed  $to = null) : mixed

Send a message.

Parameters

string $msgType

message type

mixed $message

message

mixed $to

Returns

mixed

sendText()

sendText(mixed  $message, mixed  $to = null) : mixed

Send a text message.

Parameters

mixed $message

message

mixed $to

Returns

mixed

sendNews()

sendNews(mixed  $message, mixed  $to = null) : mixed

Send a news message.

Parameters

mixed $message

message

mixed $to

Returns

mixed

sendVoice()

sendVoice(mixed  $message, mixed  $to = null) : mixed

Send a voice message.

Parameters

mixed $message

message

mixed $to

Returns

mixed

sendImage()

sendImage(mixed  $message, mixed  $to = null) : mixed

Send a image message.

Parameters

mixed $message

message

mixed $to

Returns

mixed

sendVideo()

sendVideo(mixed  $message, mixed  $to = null) : mixed

Send a video message.

Parameters

mixed $message

message

mixed $to

Returns

mixed

sendCard()

sendCard(mixed  $message, mixed  $to = null) : mixed

Send a card message.

Parameters

mixed $message

message

mixed $to

Returns

mixed

preview()

preview(string  $msgType, mixed  $message, string  $to, string  $by = self::PREVIEW_BY_OPENID) : mixed

Preview a message.

Parameters

string $msgType

message type

mixed $message

message

string $to
string $by

Returns

mixed

previewText()

previewText(mixed  $message, string  $to, string  $by = self::PREVIEW_BY_OPENID) : mixed

Preview a text message.

Parameters

mixed $message

message

string $to
string $by

Returns

mixed

previewNews()

previewNews(mixed  $message, string  $to, string  $by = self::PREVIEW_BY_OPENID) : mixed

Preview a news message.

Parameters

mixed $message

message

string $to
string $by

Returns

mixed

previewVoice()

previewVoice(mixed  $message, string  $to, string  $by = self::PREVIEW_BY_OPENID) : mixed

Preview a voice message.

Parameters

mixed $message

message

string $to
string $by

Returns

mixed

previewImage()

previewImage(mixed  $message, string  $to, string  $by = self::PREVIEW_BY_OPENID) : mixed

Preview a image message.

Parameters

mixed $message

message

string $to
string $by

Returns

mixed

previewVideo()

previewVideo(mixed  $message, string  $to, string  $by = self::PREVIEW_BY_OPENID) : mixed

Preview a video message.

Parameters

mixed $message

message

string $to
string $by

Returns

mixed

previewCard()

previewCard(mixed  $message, string  $to, string  $by = self::PREVIEW_BY_OPENID) : mixed

Preview a card message.

Parameters

mixed $message

message

string $to
string $by

Returns

mixed

previewByName()

previewByName(string  $msgType, mixed  $message,   $to) : mixed

Preview a message by name.

Parameters

string $msgType

message type

mixed $message

message

$to

Returns

mixed

previewTextByName()

previewTextByName(mixed  $message,   $to) : mixed

Preview a text message by name.

Parameters

mixed $message

message

$to

Returns

mixed

previewNewsByName()

previewNewsByName(mixed  $message,   $to) : mixed

Preview a news message by name.

Parameters

mixed $message

message

$to

Returns

mixed

previewVoiceByName()

previewVoiceByName(mixed  $message,   $to) : mixed

Preview a voice message by name.

Parameters

mixed $message

message

$to

Returns

mixed

previewImageByName()

previewImageByName(mixed  $message,   $to) : mixed

Preview a image message by name.

Parameters

mixed $message

message

$to

Returns

mixed

previewVideoByName()

previewVideoByName(mixed  $message,   $to) : mixed

Preview a video message by name.

Parameters

mixed $message

message

$to

Returns

mixed

previewCardByName()

previewCardByName(mixed  $message,   $to) : mixed

Preview a card message by name.

Parameters

mixed $message

message

$to

Returns

mixed

status()

status(string  $msgId) : \EasyWeChat\Support\Collection

Get a broadcast status.

Parameters

string $msgId

Returns

\EasyWeChat\Support\Collection

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

post()

post(string  $url, array|string  $options) : \EasyWeChat\Support\Collection

post request.

Parameters

string $url
array|string $options

Throws

\EasyWeChat\Core\Exceptions\HttpException

Returns

\EasyWeChat\Support\Collection