-
Notifications
You must be signed in to change notification settings - Fork 2
PushDispatcher
Viames Marino edited this page Feb 22, 2026
·
1 revision
Pair\Push\PushDispatcher sends a notification to all active subscriptions of a user.
It coordinates:
-
SubscriptionRepository(load subscriptions) -
WebPushSender(deliver notification) - automatic cleanup of invalid endpoints
use Pair\Push\PushDispatcher;
use Pair\Push\Notification;
$dispatcher = new PushDispatcher();
$notification = new Notification(
'Order updated',
'Your order #123 has been shipped',
'/orders/123',
'/img/icon.png',
'order-123'
);
$results = $dispatcher->sendToUser(42, $notification);sendToUser() returns a list of DeliveryResult objects, one per subscription.
- fetches all non-revoked subscriptions for user
- sends one push per subscription
- if provider returns
404or410, subscription is deleted
See also: SubscriptionRepository, WebPushSender, VapidConfig, PairPush.js.