Skip to content

EntityTag

Viames Marino edited this page Nov 6, 2026 · 1 revision

Pair framework: EntityTag

Pair\Http\EntityTag implements RFC 9110 conditional requests.

  • parse(string $value): array: complete entity-tag lists, weak tags and the standalone wildcard. Malformed syntax throws InvalidArgumentException.
  • evaluate(string $method, ?string $etag, ?string $ifMatch, ?string $ifNoneMatch, bool $exists = true): int: return 200 to proceed, 304 for a matching conditional GET/HEAD, or 412 for a failed precondition.

If-Match uses strong comparison and is evaluated before weak If-None-Match. Wildcard tests existence only; it is not a revision lock. Pass exists=false for a missing representation and etag=null if no validator was assigned. Dates and ranges are outside this helper.

Authenticate, authorize and perform normal request checks first. For writes, evaluate against the actual selected representation under the same concurrency boundary as the mutation. Checking a tag outside the write transaction does not prevent lost updates.

Clone this wiki locally