DEFAULT_TIMEOUT
DEFAULT_TIMEOUT = 10
Seconds to wait for an endpoint before giving up on one attempt.
One endpoint, the events it wants, and the secret its payloads are signed with.
A value object read out of configuration rather than a config entity, because a subscription has no identity beyond its URL and nothing else in the site refers to one. A list in a config object exports and imports with the rest of the configuration and needs no entity type, no list builder and no access handler.
An empty event list means every event. That is the shape an operator reaches for first, and making them tick six boxes to get it would only teach them to ignore the boxes.
__construct(string $url, string $secret = '', list$events = [], bool $enabled = true, int $timeout = \self::DEFAULT_TIMEOUT, int $attempts = \self::DEFAULT_ATTEMPTS) : mixed
Constructs a subscription.
| string | $url | Where the payload is posted. |
| string | $secret | The signing secret, or an empty string to send unsigned. |
| list |
$events | Event names this endpoint wants, or an empty list for every event. |
| bool | $enabled | Whether deliveries are attempted at all. |
| int | $timeout | Seconds one attempt may take. |
| int | $attempts | Attempts before the delivery is abandoned. |
fromArray(array$values) : self
Reads a subscription out of configuration.
Unknown event names are dropped rather than kept, so a subscription written against a later release does not silently receive nothing on this one; what it does receive is what this release can actually send. An empty result after filtering is the every-event shape, which is the safe direction: an operator sees too much rather than nothing.
| array |
$values | One entry of the |
The subscription.