Response-Interop Now Open For Public Review
After several rounds of private review, the Response-Interop standard interface package is now open for public review.
Response-Interop provides interoperable interfaces to encapsulate, buffer, and send server-side response values in PHP 8.4 or later, in order to reduce the global mutable state and inspection problems that exist with the PHP response-sending functions. It reflects, refines, and reconciles the common practices identified within several pre-existing projects to define these interfaces:
-
ResponseStruct encapsulates the server response status line, headers, and body.
-
ResponseHeadersCollection encapsulates the headers for the response, including affordances for cookie management.
-
ResponseBodyHandler affords management of non-string, resource-intensive, or header-modifying content.
-
ResponseCookieHelperService affords conversion of cookie representations to and from strings and arrays.
-
ResponseSenderService affords sending the server response.
-
ResponseThrowable extends Throwable to mark an Exception as response-related.
-
ResponseTypeAliases provides PHPStan type aliases to aid static analysis.
The reference implementations demonstrate how the interfaces can be used.
If you have to deal with server-side responses and are interested an interoperable set of interfaces, please offer your comments and criticism as issues or PRs out at Github.