The Status Report
Basic Usage
<?php
use WebPush\Subscription;
use WebPush\Notification;
use WebPush\WebPushService;
/** @var Notification $notification */
/** @var Subscription $subscription */
/** @var WebPushService $webPushService */
$statusReport = $webPushService->send($notification, $subscription);
if(!$statusReport->isSuccess()) {
//Something went wrong
} else {
$statusReport->getLocation();
$statusReport->getLinks();
}Helper Methods
Simplified Error Handling
Understanding Status Codes
Success Codes (2xx)
201 Created
Client Error Codes (4xx)
400 Bad Request
401 Unauthorized
404 Not Found
410 Gone
413 Payload Too Large
429 Too Many Requests
Server Error Codes (5xx)
500 Internal Server Error
502 Bad Gateway
503 Service Unavailable
Handling Errors
Comprehensive Error Handling
Retry Strategy with Exponential Backoff
Batch Processing with Error Handling
Using sendToMultiple()
Filtering Reports
Complete Batch Processing Example
Monitoring and Metrics
Debugging Failed Deliveries
Best Practices
Common Issues and Solutions
High Failure Rate
Subscriptions Expiring Quickly
Random Failures
Next Steps
Last updated
Was this helpful?