Idea
Today request matchers are plain PHP callbacks registered globally in Configuration. Two improvements have been proposed in PR #266:
RequestMatcherInterface — make matchers typed objects instead of raw callbacks, improving type safety and IDE support.
- Cassette-scoped matchers — store matchers per cassette instead of globally, so different cassettes can use different matching strategies without global state changes.
Motivation
Complex matching scenarios (e.g. "match all requests to /product except when id=42, which should match on query string too") currently require a single global custom callback that encodes all the logic. Cassette-scoped matchers would allow per-request matcher overrides directly in the cassette definition.
BC break
Both changes are backwards-incompatible:
RequestMatcherInterface replaces the current callable type
- Cassette-stored matchers change the cassette format
Target: 2.0 only.
Reference
See PR #266 for a prior implementation attempt. The PR is too old to merge directly — the codebase has changed significantly — but the concept is sound.
Idea
Today request matchers are plain PHP callbacks registered globally in
Configuration. Two improvements have been proposed in PR #266:RequestMatcherInterface— make matchers typed objects instead of raw callbacks, improving type safety and IDE support.Motivation
Complex matching scenarios (e.g. "match all requests to
/productexcept whenid=42, which should match on query string too") currently require a single global custom callback that encodes all the logic. Cassette-scoped matchers would allow per-request matcher overrides directly in the cassette definition.BC break
Both changes are backwards-incompatible:
RequestMatcherInterfacereplaces the current callable typeTarget: 2.0 only.
Reference
See PR #266 for a prior implementation attempt. The PR is too old to merge directly — the codebase has changed significantly — but the concept is sound.