php-fig/fig-standards — pull request #366 by weierophinney (2014-11-02 19:33:29+00:00)
Title: [PSR-7] Selective Mutability

Per the recent mailing list discussions, as well as in-person discussions conducted during ZendCon, I've done the following:

- Updated `MessageInterface` such that it only describes getters. This allows it to serve as the basis for all other messages, whether or not they provide mutability. Additionally, `getBody()` has been updated to require that the implementation _always_ return a `StreamableInterface` instance.
- Removed `RequestInterface` and `ResponseInterface`.
- Created an `OutgoingRequestInterface` that provides setters for the various items in `MessageInterface`, as well as provides getters/setters for the URL and HTTP method. The URL is now required to be a string.
- Created an `IncomingResponseInterface` that provides getters for the status code and reason phrase. It is _immutable_.
- Created an `IncomingRequestInterface` that provides getters for the URL and HTTP method, as well as:
- server params (aka `$_SERVER`).
- cookie params (aka `$_COOKIE`).
- query string arguments (aka `$_GET`).
- body params (aka `$_POST`, but potentially the results of deserializing the body if the results can be represented as an array).
- upload file metadata (aka `$_FILES`).
Additionally, one _mutable_ property, `attributes`, is provided to allow injecting the request with parameters derived from it (e.g., decrypted cookie parameters, deserialized body parameters, parameters from matching the path, etc.).
- Created an `OutgoingResponseInterface` that provides setters for the various items in `MessageInterface`, as well as provides getters/setters around the status code and reason phrase. `setStatusCode()` and `setReasonPhrase()` were combined into `setStatus($code, $reasonPhrase = null)`.

I have updated the proposal narrative to delineate the client- vs. server-side usage of the various interfaces, and also updated the meta document to describe the decisions.