Skip to content

DeliveryResult

Viames Marino edited this page Feb 22, 2026 · 1 revision

Pair framework: DeliveryResult

Pair\Push\DeliveryResult is a value object representing the outcome of one push delivery attempt.

Properties

  • success (bool)
  • statusCode (?int)
  • error (?string)
  • endpoint (string)
  • shouldDeleteSubscription (bool)

Constructor

new DeliveryResult(
    string $endpoint,
    bool $success = false,
    ?int $statusCode = null,
    ?string $error = null,
    bool $shouldDeleteSubscription = false
)

Typical usage in dispatch loop

$results = $dispatcher->sendToUser($userId, $notification);

foreach ($results as $result) {
    if ($result->success) {
        continue;
    }

    // log issue
    error_log('Push failed for ' . $result->endpoint . ': ' . ($result->error ?? 'unknown'));

    if ($result->shouldDeleteSubscription) {
        // already handled by dispatcher in default flow
    }
}

Semantics

  • success=true means provider accepted delivery.
  • statusCode may be null when provider report is unavailable.
  • shouldDeleteSubscription=true indicates stale/invalid endpoint (typically HTTP 404/410).

See also: PushDispatcher, WebPushSender, Notification.

Clone this wiki locally