Repository navigation
WebPushSender
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 a custom VapidConfig. With Minishlink Web Push 11, a PSR-3 logger can also be supplied as logger.
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
Pair sends aes128gcm payloads to Apple and Microsoft WNS. For an Edge
subscription hosted at *.notify.windows.com, Pair uses the Minishlink
11 PSR-18 client to send the encrypted payload with X-WNS-Type: wns/raw.
Other endpoints retain their existing content encoding.
Applications that accept browser subscriptions can call
Pair\Push\PushEndpoint::isSupported($endpoint) to allow only HTTPS endpoints
on the standard Google, Mozilla, Apple and Microsoft push hosts. Custom push
services can retain their own endpoint validation.
$result = $sender->send($notification, $subscription);
if (!$result->success) {
// inspect $result->error and $result->statusCode
}See also: VapidConfig, PushDispatcher, PairPush.js.
Maintained by Viames Marino — VM Ingegneria · Professional enquiries
Home · Setup · Configuration
Build with Pair 4
- Generator
- Controllers and responses
- Read models
- ActiveRecord and queries
- Forms and validation
- PairUI.js, PairMotion.js and HTML fragments
APIs and authentication
- API guide and CRUD
- Middleware and rate limits
- Users, sessions, and ACL
- Passkeys and social login
- Native mobile setup
Integrate and operate
- Integrations
- Runtime extensions and adapter keys
- Cache and cache stores
- Logs and observability
- PWA and push
- Packages and distribution
- Upgrade to v4