This interfaces are already (and amazingly) implemented by Laminas at projects: Diactoros and Stratigility. Siler wraps them and exposes a function-friendly API handling state internally while achieving a fully-featured and declarative way for: Middleware Pipelining.
PSR-7 HTTP Messages
Siler doesn't have direct dependencies, to stay fit, it favors peer dependencies, which means you have to explicitly declare a diactoros dependency in your project in order to use it.
composerrequirelaminas/laminas-diactoros
You can create a superglobals seeded ServerRequest with Siler\Diactoros\request():
To emit a Response, there is no big deal, if you got Siler, you already imagined that is about one or two function calls, but this time we get the help from HttpHandlerRunner:
composerrequirelaminas/laminas-httphandlerrunner
Then
HttpHandlerRunner\sapi_emit($response);
As in Siler\Http\Response namespace functions, the HttpHandlerRunner\sapi_emit will output headers and text to the buffer, use it carefully.
Siler doesn't have direct dependencies, to stay fit, it favors peer dependencies, which means you have to explicitly declare a stratigility dependency in your project in order to use it.
The second argument on pipe here is a Pipeline name, you can pipe middlewares to any number of pipelines, then in Stratigility\process we marshal it, from the given $request and returns a Closure to be called on a final handler.
Creates a Stratigility MiddlewarePipe with a default name and pipes the given Clousure to it already wrapping it inside a MiddlewareInterface decorator, or you can pass any implementation MiddlewareInterface to it.
text
Creates a Diactoros TextResponse. The Diactoros namespace in Siler is basically just helper functions for Responses.
sapi_emit
Creates and immediately calls emit method on a HttpHandlerRunner SapiEmitter.
handle
Calls handle on a MiddlewarePipe marshaling the Request.
request
Creates a Diactoros ServerRequest using PHP's Globals.