DiscordPHP-NHA Documentation

Out extends Part
in package

AbstractYes

Base class for read-only NHA response Parts.

Every concrete subclass corresponds to one *Out schema in the NHA OpenAPI document and declares that schema's documented fields in $fillable (which drives IDE @property hints and jsonSerialize()).

The NHA API contract states that "endpoints may return additional keys (models allow extras), so clients should tolerate them". DiscordPHP's Part::fill() silently drops any key not in $fillable, so this base overrides fill/serialisation to keep the whole payload: undeclared keys remain readable via $part->someExtraKey and survive json_encode().

Tags
link

Machine-readable API contract

Interactive API documentation

since
3.0.0

Table of Contents

Methods

fill()  : void
Stores the full decoded payload, then applies any declared attribute mutators. Unlike the parent, keys absent from `$fillable` are preserved so the model tolerates the extra keys the NHA API is allowed to add.
jsonSerialize()  : array<string|int, mixed>
Serialises back to the full raw payload (lossless), not just the declared subset, so round-tripping an NHA response never discards fields.

Methods

fill()

Stores the full decoded payload, then applies any declared attribute mutators. Unlike the parent, keys absent from `$fillable` are preserved so the model tolerates the extra keys the NHA API is allowed to add.

public fill(array<string|int, mixed> $attributes) : void
Parameters
$attributes : array<string|int, mixed>

The decoded response body.

jsonSerialize()

Serialises back to the full raw payload (lossless), not just the declared subset, so round-tripping an NHA response never discards fields.

public jsonSerialize() : array<string|int, mixed>
Return values
array<string|int, mixed>
On this page

Search results