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
| Name | Type | Description |
|---|---|---|
| $type | string | Notification type (e.g., 'action_result', 'alert', 'report') |
| $title | string | Notification title |
| $data | array<string, mixed> | Notification data |
| $template | (string | null) | Optional template name |
| $metadata | array<string, mixed> | Additional metadata |
NotificationPayload::getType()
public function getType(): stringNotificationPayload::getTitle()
public function getTitle(): stringNotificationPayload::getData()
public function getData(): arrayNotificationPayload::getTemplate()
public function getTemplate(): ?stringNotificationPayload::getMetadata()
public function getMetadata(): arrayNotificationPayload::fromArray()
public static function fromArray(array $data): selfCreate from array (useful for deserialization).
Parameters
| Name | Type | Description |
|---|---|---|
| $data | array<string, mixed> |
NotificationPayload::toArray()
public function toArray(): arrayConvert to array (useful for serialization).