-
Notifications
You must be signed in to change notification settings - Fork 2
WebPushSender
Viames Marino edited this page Feb 22, 2026
·
1 revision
Pair\Push\WebPushSender delivers a single push notification to one subscription using VAPID and minishlink/web-push.
Composer package:
composer require minishlink/web-pushIf library is missing, constructor throws RuntimeException.
$sender = new \Pair\Push\WebPushSender();Optionally pass custom VapidConfig.
Behavior:
- builds WebPush auth config from VAPID keys
- creates Minishlink subscription object
- serializes notification payload as JSON
- sends notification and parses report
- marks invalid subscriptions (
404,410) withshouldDeleteSubscription=true
For host web.push.apple.com, Pair uses aes128gcm; otherwise default aesgcm.
$result = $sender->send($notification, $subscription);
if (!$result->success) {
// inspect $result->error and $result->statusCode
}See also: VapidConfig, PushDispatcher, PairPush.js.