Please excuse my naivete, but upon making PSR 15 classes, I noticed an issue which I have not found satisfactorily resolved online or in this discussion group.
The idea behind interoperability is to make sure things work on different systems. Part of doing this is making sure there is a standard interface for normal activity. Part of normal activity of a middleware would be altering the response body. But, this presents a problem, since there is no standard method for going about creating a new stream within middleware. What is the standard for accessing a Psr\Http\Message\StreamInterface implementation from within middleware? - if I want to modify the body, I have to make a new stream (seeking and writing will often not fit) I would suggest, given the commonallity of not caring about streams in some middleware, the response gains two functions: 1. "withBodyString()" 2. possibly "getBodyString()" for expectation (just does __toString()) Further, I would suggest two combined things for middleware: 1. ServerRequestInterface should also implement all the PSR 17 interfaces. Thus, middleware would access a factory like `$handler->createResponse()`. This itself, the extended interface implementation, could be a PSR. 2. Middleware constructor interface dependencies should be resolved, allowing injection of factories. Combined, the ServerRequestInterface could just inject itself wherever a PSR 17 factory was required. However, #2 puts the demand of interface dependency injection the the implementer. Without a standard, constructing middleware relies on knowing what the framework will do. If the assumption is that middleware will have the factories injected, this should be stated in the standard as the standard. -- You received this message because you are subscribed to the Google Groups "PHP Framework Interoperability Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/php-fig/6ddea91e-1c32-4948-8b80-ca7a7ca461edn%40googlegroups.com.
