A big motivation behind the Virtual Rest Service RFC was to provide a generic and universal interface for the interaction with local or remote services from PHP code. So far, we have only partially achieved this goal. The VRS code is in core, but each consumer still needs to set up their own VRS service.
To actually achieve the degree of generality and abstraction we aimed for, we should centrally configure a singleton VRS object, and make it available to any core or extension code, perhaps from RequestContext. Construction could happen lazily on first access, so that requests without VRS use don't incur overheads.
The path structure would ideally mirror that of our external APIs at /api/, without the current per-service prefixes like /restbase/. Strawman:
- /{domain}/rest_v1/... for the REST API for $domain
- /local/rest_v1/... for the REST API of the local domain (magically resolved)
- /local/action/... for the action API (possibly a wrapper around FauxRequest, if that can be made to support parallelism)