SubscriptionRepository - viames/pair GitHub Wiki
Pair framework: SubscriptionRepository
Pair\Push\SubscriptionRepository manages push_subscriptions persistence.
Main operations
upsert(?int $userId, array $subscription, ?string $userAgent): void
Insert or update by endpoint.
Expected payload fields:
endpointkeys.p256dh(or top-levelp256dh)keys.auth(or top-levelauth)
If required fields are missing, it throws InvalidArgumentException.
listByUser(int $userId): Collection
Returns active subscriptions for user (revoked_at IS NULL).
revokeByEndpoint(string $endpoint): void
Soft-revokes endpoint (revoked_at timestamp).
deleteByEndpoint(string $endpoint): void
Hard delete by endpoint.
Notes
upsert()also refreshesupdated_atandlast_seen_at.user_agentis truncated to 255 chars.- endpoint must be unique in table design for correct upsert behavior.
See also: PushDispatcher, WebPushSender, PairPush.js.