Skip to content

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

Merged
merged 5 commits into from
Nov 19, 2016
Merged

Conversation

shadowhand
Copy link
Collaborator

@shadowhand shadowhand commented Nov 6, 2016

Importing the meta document from PSR-15 for review and editing.

Refs #25

Importing the meta document from PSR-15 for review and editing.
@shadowhand shadowhand changed the title Update README with meta doc Import PSR meta as README Nov 6, 2016
@shadowhand
Copy link
Collaborator Author

shadowhand commented Nov 6, 2016

This is the current meta document from php-fig/fig-standards PSR-15-meta.

sasezaki added a commit to sasezaki/php-http-middleware-ideas that referenced this pull request Nov 7, 2016
Copy link

@weierophinney weierophinney left a 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

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...

Copy link
Collaborator Author

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.

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`.

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.

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:

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.
@shadowhand
Copy link
Collaborator Author

@http-interop/http-middleware-contributors this now contains the changes from #25. Please review and let me know if you have concerns.

@weierophinney
Copy link

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 !

@shadowhand
Copy link
Collaborator Author

@weierophinney added.

Copy link

@weierophinney weierophinney left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@shadowhand shadowhand merged commit 08c50a4 into master Nov 19, 2016
@shadowhand shadowhand deleted the feature/import-meta-as-readme branch November 19, 2016 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants