-
Notifications
You must be signed in to change notification settings - Fork 7
Import PSR meta as README #26
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
Conversation
Importing the meta document from PSR-15 for review and editing.
This is the current meta document from php-fig/fig-standards PSR-15-meta. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few minor verbiage changes, and a couple of questions.
@@ -1,3 +1,226 @@ | |||
# HTTP Middleware | |||
HTTP Middleware |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was going to suggest changing the above to "HTTP Server Middleware", and then realized #25 is a PR against this branch, doing that...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct. This PR should be accepted as-is, it is just a copy of the existing meta document.
|
||
* The middleware is defined as a [callable][php-callable] using `__invoke`. | ||
* The middleware is passed 3 arguments during invocation: | ||
1. A `RequestInterface` implementation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we're talking server-side middleware, this would be a ServerRequestInterface
. Not sure if it requires updating or not, but would likely lead to less confusion later.
Based on the middleware implementations already used by frameworks that have | ||
adopted this signature, the following commonalities are observed: | ||
|
||
* The middleware is defined as a [callable][php-callable] using `__invoke`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but sometimes also as a closure, function, or other instance method. Usage of __invoke()
is not required by most of the various PSR-7 dispatchers I've seen.
* The middleware is defined as a [callable][php-callable] using a [closure][php-closure] | ||
or a class with an `__invoke` method. | ||
* The middleware is passed 2 arguments during invocation: | ||
1. A `RequestInterface` implementation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, wondering if this should be ServerRequestInterface
.
``` | ||
|
||
[Laravel middleware](https://laravel.com/docs/master/middleware) does make use | ||
of HTTP Messages but supports middleware with the signature: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you trying to indicate it makes use of PSR-7 HTTP Messages (which is what you appear to mean everywhere else int the document when you use the verbiage "HTTP Messages")? I'm thinking you meant to say "does not" here...
Rework document based on current interfaces. Add more detail regarding design decisions and clarify intent to focus on server middleware.
@http-interop/http-middleware-contributors this now contains the changes from #25. Please review and let me know if you have concerns. |
This looks good. The only change I'd like to see is some verbiage indicating that the delegate defines the same method as middleware in part to prevent creating an object that can serve both roles. Nice work, @shadowhand ! |
@weierophinney added. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Importing the meta document from PSR-15 for review and editing.
Refs #25