DiscordPHP Documentation

Payload
in package
implements JsonSerializable

Represents a Gateway event payload.

Gateway event payloads have a common structure, but the contents of the associated data (d) varies between the different events.

Tags
link
https://docs.discord.com/developers/topics/gateway#payloads-gateway-payload-structure

Table of Contents

Interfaces

JsonSerializable

Properties

$d  : mixed|null
$op  : int
$s  : int|null
$t  : string|null

Methods

__construct()  : mixed
__debugInfo()  : array<string|int, mixed>
Debug representation: the serialised payload with large `d` bodies summarised.
fromArray()  : self
Builds a payload from a decoded gateway frame array (`op`, `d`, `s`, `t`).
jsonSerialize()  : array<string|int, mixed>
new()  : self
Convenience factory; see {@see __construct()} for the parameters.

Properties

Methods

__construct()

public __construct(int $op[, mixed $d = null ][, int|null $s = null ][, string|null $t = null ]) : mixed
Parameters
$op : int

Gateway opcode.

$d : mixed = null

Event data / payload.

$s : int|null = null

Sequence number (dispatch only).

$t : string|null = null

Event name (dispatch only).

__debugInfo()

Debug representation: the serialised payload with large `d` bodies summarised.

public __debugInfo() : array<string|int, mixed>
Return values
array<string|int, mixed>

fromArray()

Builds a payload from a decoded gateway frame array (`op`, `d`, `s`, `t`).

public static fromArray(array<string|int, mixed> $data) : self
Parameters
$data : array<string|int, mixed>
Return values
self

jsonSerialize()

public jsonSerialize() : array<string|int, mixed>
Tags
inheritDoc
Return values
array<string|int, mixed>

new()

Convenience factory; see {@see __construct()} for the parameters.

public static new(int $op[, mixed $d = null ][, int|null $s = null ][, string|null $t = null ]) : self
Parameters
$op : int
$d : mixed = null
$s : int|null = null
$t : string|null = null
Return values
self
On this page

Search results