-
Notifications
You must be signed in to change notification settings - Fork 2
Notification
Viames Marino edited this page Feb 22, 2026
·
1 revision
Pair\Push\Notification is the payload value object for web push messages.
new Notification(
string $title,
string $body,
?string $url = null,
?string $icon = null,
?string $tag = null,
array $data = []
)Builds service-worker-compatible payload:
- always includes
title,body - adds
iconandtagwhen set - merges custom
data - injects
urlintodata.urlwhen provided
Basic notification:
$notification = new \Pair\Push\Notification(
'New message',
'You have a new message.'
);With deep-link and metadata:
$notification = new \Pair\Push\Notification(
'Order shipped',
'Order #123 has been shipped.',
'/orders/123',
'/img/push/order.png',
'order-123',
['orderId' => 123, 'type' => 'shipping-update']
);Payload sent to push sender:
$payload = $notification->toPayload();$dispatcher = new \Pair\Push\PushDispatcher();
$results = $dispatcher->sendToUser($userId, $notification);See also: PushDispatcher, DeliveryResult, WebPushSender.