-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide built-in HTTP response factories, support PSR-17 #2056
Comments
Wouldn't a ResponseFactory be better than making a Response class for every possible status? |
We'll hit the main ones I think. We could also do something like |
@geekish Can you post a very brief snippet of code that demonstrates what you're thinking? |
Looks like they're trying to create a PSR for HTTP factories, think something like this: But with some methods like: public function createRedirectResponse($url, $status = 302) {
return (new Response)->withHeader('Location', $url)->withStatus($status);
}
public function createJsonResponse($url, $content) {
// basically the code Response->withJson() does
} |
See #2048 (comment) |
For reference there is currently two PSR-17 implementations supporting Slim. Mine is for https://github.com/tuupola/http-factory HTTP Interop also provides integration tests. |
This is a Slim-Http thing. See slimphp/Slim-Http#27 |
Closing, this has been resolved. Slim-Psr7/pull/27 has been merged. |
Implement HTTP factories for PSR-7 response object creation, covering:
Also perhaps factory methods to return new Response for content types (e.g. JSON, XML, CSV).
NOTE: Updated this post based on subsequent discussion.
The text was updated successfully, but these errors were encountered: