Skip to content
docsv0.1.0

NotificationPayload

Notification payload data transfer object. Contains all data needed for a notification to be rendered and sent. A default implementation of {@see NotificationPayloadInterface} — channels may accept any implementation of the interface.

NotificationPayload::__construct()

public function __construct(string $type, string $title, array $data = [], ?string $template = null, array $metadata = []):

Parameters

Parameters of __construct()
NameTypeDescription
$typestringNotification type (e.g., 'action_result', 'alert', 'report')
$titlestringNotification title
$dataarray<string, mixed>Notification data
$template(string | null)Optional template name
$metadataarray<string, mixed>Additional metadata

NotificationPayload::getType()

public function getType(): string

NotificationPayload::getTitle()

public function getTitle(): string

NotificationPayload::getData()

public function getData(): array

NotificationPayload::getTemplate()

public function getTemplate(): ?string

NotificationPayload::getMetadata()

public function getMetadata(): array

NotificationPayload::fromArray()

public static function fromArray(array $data): self

Create from array (useful for deserialization).

Parameters

Parameters of fromArray()
NameTypeDescription
$dataarray<string, mixed>

NotificationPayload::toArray()

public function toArray(): array

Convert to array (useful for serialization).