{"action":"created","comment":{"url":"https://api.github.com/repos/php-fig/fig-standards/pulls/comments/63275100","id":63275100,"diff_hunk":"@@ -0,0 +1,90 @@\n+HTTP Middleware\n+===============\n+\n+This document describes a common standard for HTTP middleware components using\n+[PSR-7][psr7] compliant HTTP messages.\n+\n+HTTP middleware has been an important concept on other web development platforms\n+for a good number of years, and since the inception of PSR-7 has been growing\n+increasingly popular in the PHP world.\n+\n+An informal (de-facto) standard for the signature of middleware components is\n+already widely in use, and this PSR serves to provide a formal definition in\n+the form of a common standard interface for middleware components.\n+\n+The interface described in this document is an abstraction of an individual\n+middleware component.\n+\n+The key words \"MUST\", \"MUST NOT\", \"REQUIRED\", \"SHALL\", \"SHALL NOT\", \"SHOULD\",\n+\"SHOULD NOT\", \"RECOMMENDED\", \"MAY\", and \"OPTIONAL\" in this document are to be\n+interpreted as described in [RFC 2119][rfc2119].\n+\n+[psr7]: http://www.php-fig.org/psr/psr-7/\n+[rfc2119]: http://tools.ietf.org/html/rfc2119\n+\n+## 1. Specification\n+\n+An HTTP middleware component is an individual component participating, together\n+with other middleware components, in the processing of an incoming HTTP Request\n+and the creation of a resulting HTTP Response, as defined by PSR-7.\n+\n+Middleware components MUST implement this interface.\n+\n+Middleware consumers (e.g. frameworks and middleware stacks) MUST type-hint any\n+method accepting middleware components as arguments formally as `callable`, and\n+informally as `Psr\\Http\\Middleware\\MiddlewareInterface`, e.g. using php-doc tags:\n+\n+```php\n+/**\n+ * @param MiddlewareInterface $middleware\n+ */\n+public function push(callable $middleware)\n+{\n+    // ...\n+}\n+```\n+\n+## 2. Interfaces\n+\n+```php\n+namespace Psr\\Http\\Middleware;\n+\n+use Psr\\Http\\Message\\RequestInterface;\n+use Psr\\Http\\Message\\ResponseInterface;\n+\n+interface MiddlewareInterface\n+{\n+    /**\n+     * Process a request and return a response.\n+     *\n+     * Takes the incoming request and optionally modifies it before delegating\n+     * to the next handler to get a response. May modify the response before\n+     * ultimately returning it.\n+     *\n+     * @param RequestInterface $request\n+     * @param ResponseInterface $response\n+     * @param callable $next\n+     *\n+     * @return ResponseInterface\n+     */\n+    public function __invoke(\n+        RequestInterface $request,\n+        ResponseInterface $response,\n+        callable $next\n+    );\n+}\n+```\n+\n+The callable `$next` refers to a middleware dispatcher that will pass the given\n+request and response instances to the next middleware in the queue. It MUST NOT\n+be a middleware component.","path":"proposed/middleware.md","position":80,"original_position":80,"commit_id":"71187c9afc596372ba4a15f0fd91bd43ed6bd11c","original_commit_id":"71187c9afc596372ba4a15f0fd91bd43ed6bd11c","user":{"login":"mindplay-dk","id":103348,"avatar_url":"https://avatars.githubusercontent.com/u/103348?v=3","gravatar_id":"","url":"https://api.github.com/users/mindplay-dk","html_url":"https://github.com/mindplay-dk","followers_url":"https://api.github.com/users/mindplay-dk/followers","following_url":"https://api.github.com/users/mindplay-dk/following{/other_user}","gists_url":"https://api.github.com/users/mindplay-dk/gists{/gist_id}","starred_url":"https://api.github.com/users/mindplay-dk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mindplay-dk/subscriptions","organizations_url":"https://api.github.com/users/mindplay-dk/orgs","repos_url":"https://api.github.com/users/mindplay-dk/repos","events_url":"https://api.github.com/users/mindplay-dk/events{/privacy}","received_events_url":"https://api.github.com/users/mindplay-dk/received_events","type":"User","site_admin":false},"body":">I documented the $next details here, but it sounds like I need to put it in the interface itself? \r\n\r\nYes, please - inline documentation e.g. like [here](https://github.com/mindplay-dk/middleman/blob/master/src/MiddlewareInterface.php#L20).\r\n\r\n> For reference, `Relay\\Runner` does it quite elegantly and this signature could easily be made into a general interface\r\n\r\nI thought we agreed that standardizing on the dispatcher interface is pointless?\r\n\r\nWe shouldn't do it just because we can.\r\n","created_at":"2016-05-14T11:53:20Z","updated_at":"2016-05-14T11:53:20Z","html_url":"https://github.com/php-fig/fig-standards/pull/755#discussion_r63275100","pull_request_url":"https://api.github.com/repos/php-fig/fig-standards/pulls/755","_links":{"self":{"href":"https://api.github.com/repos/php-fig/fig-standards/pulls/comments/63275100"},"html":{"href":"https://github.com/php-fig/fig-standards/pull/755#discussion_r63275100"},"pull_request":{"href":"https://api.github.com/repos/php-fig/fig-standards/pulls/755"}}},"pull_request":{"url":"https://api.github.com/repos/php-fig/fig-standards/pulls/755","id":69503116,"html_url":"https://github.com/php-fig/fig-standards/pull/755","diff_url":"https://github.com/php-fig/fig-standards/pull/755.diff","patch_url":"https://github.com/php-fig/fig-standards/pull/755.patch","issue_url":"https://api.github.com/repos/php-fig/fig-standards/issues/755","number":755,"state":"open","locked":false,"title":"Create initial proposal for middleware interface","user":{"login":"shadowhand","id":38203,"avatar_url":"https://avatars.githubusercontent.com/u/38203?v=3","gravatar_id":"","url":"https://api.github.com/users/shadowhand","html_url":"https://github.com/shadowhand","followers_url":"https://api.github.com/users/shadowhand/followers","following_url":"https://api.github.com/users/shadowhand/following{/other_user}","gists_url":"https://api.github.com/users/shadowhand/gists{/gist_id}","starred_url":"https://api.github.com/users/shadowhand/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shadowhand/subscriptions","organizations_url":"https://api.github.com/users/shadowhand/orgs","repos_url":"https://api.github.com/users/shadowhand/repos","events_url":"https://api.github.com/users/shadowhand/events{/privacy}","received_events_url":"https://api.github.com/users/shadowhand/received_events","type":"User","site_admin":false},"body":"Based on discussions here: https://groups.google.com/d/msg/php-fig/vTtGxdIuBX8/NXKieN9vDQAJ","created_at":"2016-05-10T13:10:58Z","updated_at":"2016-05-14T11:53:20Z","closed_at":null,"merged_at":null,"merge_commit_sha":"875f99785476181b1d1e9ef586bd7d734e7245da","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/php-fig/fig-standards/pulls/755/commits","review_comments_url":"https://api.github.com/repos/php-fig/fig-standards/pulls/755/comments","review_comment_url":"https://api.github.com/repos/php-fig/fig-standards/pulls/comments{/number}","comments_url":"https://api.github.com/repos/php-fig/fig-standards/issues/755/comments","statuses_url":"https://api.github.com/repos/php-fig/fig-standards/statuses/71187c9afc596372ba4a15f0fd91bd43ed6bd11c","head":{"label":"shadowhand:middleware","ref":"middleware","sha":"71187c9afc596372ba4a15f0fd91bd43ed6bd11c","user":{"login":"shadowhand","id":38203,"avatar_url":"https://avatars.githubusercontent.com/u/38203?v=3","gravatar_id":"","url":"https://api.github.com/users/shadowhand","html_url":"https://github.com/shadowhand","followers_url":"https://api.github.com/users/shadowhand/followers","following_url":"https://api.github.com/users/shadowhand/following{/other_user}","gists_url":"https://api.github.com/users/shadowhand/gists{/gist_id}","starred_url":"https://api.github.com/users/shadowhand/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shadowhand/subscriptions","organizations_url":"https://api.github.com/users/shadowhand/orgs","repos_url":"https://api.github.com/users/shadowhand/repos","events_url":"https://api.github.com/users/shadowhand/events{/privacy}","received_events_url":"https://api.github.com/users/shadowhand/received_events","type":"User","site_admin":false},"repo":{"id":47408693,"name":"fig-standards","full_name":"shadowhand/fig-standards","owner":{"login":"shadowhand","id":38203,"avatar_url":"https://avatars.githubusercontent.com/u/38203?v=3","gravatar_id":"","url":"https://api.github.com/users/shadowhand","html_url":"https://github.com/shadowhand","followers_url":"https://api.github.com/users/shadowhand/followers","following_url":"https://api.github.com/users/shadowhand/following{/other_user}","gists_url":"https://api.github.com/users/shadowhand/gists{/gist_id}","starred_url":"https://api.github.com/users/shadowhand/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shadowhand/subscriptions","organizations_url":"https://api.github.com/users/shadowhand/orgs","repos_url":"https://api.github.com/users/shadowhand/repos","events_url":"https://api.github.com/users/shadowhand/events{/privacy}","received_events_url":"https://api.github.com/users/shadowhand/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/shadowhand/fig-standards","description":"Standards either proposed or approved by the Framework Interop Group","fork":true,"url":"https://api.github.com/repos/shadowhand/fig-standards","forks_url":"https://api.github.com/repos/shadowhand/fig-standards/forks","keys_url":"https://api.github.com/repos/shadowhand/fig-standards/keys{/key_id}","collaborators_url":"https://api.github.com/repos/shadowhand/fig-standards/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/shadowhand/fig-standards/teams","hooks_url":"https://api.github.com/repos/shadowhand/fig-standards/hooks","issue_events_url":"https://api.github.com/repos/shadowhand/fig-standards/issues/events{/number}","events_url":"https://api.github.com/repos/shadowhand/fig-standards/events","assignees_url":"https://api.github.com/repos/shadowhand/fig-standards/assignees{/user}","branches_url":"https://api.github.com/repos/shadowhand/fig-standards/branches{/branch}","tags_url":"https://api.github.com/repos/shadowhand/fig-standards/tags","blobs_url":"https://api.github.com/repos/shadowhand/fig-standards/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/shadowhand/fig-standards/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/shadowhand/fig-standards/git/refs{/sha}","trees_url":"https://api.github.com/repos/shadowhand/fig-standards/git/trees{/sha}","statuses_url":"https://api.github.com/repos/shadowhand/fig-standards/statuses/{sha}","languages_url":"https://api.github.com/repos/shadowhand/fig-standards/languages","stargazers_url":"https://api.github.com/repos/shadowhand/fig-standards/stargazers","contributors_url":"https://api.github.com/repos/shadowhand/fig-standards/contributors","subscribers_url":"https://api.github.com/repos/shadowhand/fig-standards/subscribers","subscription_url":"https://api.github.com/repos/shadowhand/fig-standards/subscription","commits_url":"https://api.github.com/repos/shadowhand/fig-standards/commits{/sha}","git_commits_url":"https://api.github.com/repos/shadowhand/fig-standards/git/commits{/sha}","comments_url":"https://api.github.com/repos/shadowhand/fig-standards/comments{/number}","issue_comment_url":"https://api.github.com/repos/shadowhand/fig-standards/issues/comments{/number}","contents_url":"https://api.github.com/repos/shadowhand/fig-standards/contents/{+path}","compare_url":"https://api.github.com/repos/shadowhand/fig-standards/compare/{base}...{head}","merges_url":"https://api.github.com/repos/shadowhand/fig-standards/merges","archive_url":"https://api.github.com/repos/shadowhand/fig-standards/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/shadowhand/fig-standards/downloads","issues_url":"https://api.github.com/repos/shadowhand/fig-standards/issues{/number}","pulls_url":"https://api.github.com/repos/shadowhand/fig-standards/pulls{/number}","milestones_url":"https://api.github.com/repos/shadowhand/fig-standards/milestones{/number}","notifications_url":"https://api.github.com/repos/shadowhand/fig-standards/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/shadowhand/fig-standards/labels{/name}","releases_url":"https://api.github.com/repos/shadowhand/fig-standards/releases{/id}","deployments_url":"https://api.github.com/repos/shadowhand/fig-standards/deployments","created_at":"2015-12-04T14:28:27Z","updated_at":"2015-12-04T14:07:29Z","pushed_at":"2016-05-13T22:01:45Z","git_url":"git://github.com/shadowhand/fig-standards.git","ssh_url":"git@github.com:shadowhand/fig-standards.git","clone_url":"https://github.com/shadowhand/fig-standards.git","svn_url":"https://github.com/shadowhand/fig-standards","homepage":"http://www.php-fig.org/","size":1925,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"php-fig:master","ref":"master","sha":"7dd947db59d39099ad0095ab904e0c71bbf49812","user":{"login":"php-fig","id":468401,"avatar_url":"https://avatars.githubusercontent.com/u/468401?v=3","gravatar_id":"","url":"https://api.github.com/users/php-fig","html_url":"https://github.com/php-fig","followers_url":"https://api.github.com/users/php-fig/followers","following_url":"https://api.github.com/users/php-fig/following{/other_user}","gists_url":"https://api.github.com/users/php-fig/gists{/gist_id}","starred_url":"https://api.github.com/users/php-fig/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/php-fig/subscriptions","organizations_url":"https://api.github.com/users/php-fig/orgs","repos_url":"https://api.github.com/users/php-fig/repos","events_url":"https://api.github.com/users/php-fig/events{/privacy}","received_events_url":"https://api.github.com/users/php-fig/received_events","type":"Organization","site_admin":false},"repo":{"id":1053270,"name":"fig-standards","full_name":"php-fig/fig-standards","owner":{"login":"php-fig","id":468401,"avatar_url":"https://avatars.githubusercontent.com/u/468401?v=3","gravatar_id":"","url":"https://api.github.com/users/php-fig","html_url":"https://github.com/php-fig","followers_url":"https://api.github.com/users/php-fig/followers","following_url":"https://api.github.com/users/php-fig/following{/other_user}","gists_url":"https://api.github.com/users/php-fig/gists{/gist_id}","starred_url":"https://api.github.com/users/php-fig/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/php-fig/subscriptions","organizations_url":"https://api.github.com/users/php-fig/orgs","repos_url":"https://api.github.com/users/php-fig/repos","events_url":"https://api.github.com/users/php-fig/events{/privacy}","received_events_url":"https://api.github.com/users/php-fig/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/php-fig/fig-standards","description":"Standards either proposed or approved by the Framework Interop Group","fork":false,"url":"https://api.github.com/repos/php-fig/fig-standards","forks_url":"https://api.github.com/repos/php-fig/fig-standards/forks","keys_url":"https://api.github.com/repos/php-fig/fig-standards/keys{/key_id}","collaborators_url":"https://api.github.com/repos/php-fig/fig-standards/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/php-fig/fig-standards/teams","hooks_url":"https://api.github.com/repos/php-fig/fig-standards/hooks","issue_events_url":"https://api.github.com/repos/php-fig/fig-standards/issues/events{/number}","events_url":"https://api.github.com/repos/php-fig/fig-standards/events","assignees_url":"https://api.github.com/repos/php-fig/fig-standards/assignees{/user}","branches_url":"https://api.github.com/repos/php-fig/fig-standards/branches{/branch}","tags_url":"https://api.github.com/repos/php-fig/fig-standards/tags","blobs_url":"https://api.github.com/repos/php-fig/fig-standards/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/php-fig/fig-standards/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/php-fig/fig-standards/git/refs{/sha}","trees_url":"https://api.github.com/repos/php-fig/fig-standards/git/trees{/sha}","statuses_url":"https://api.github.com/repos/php-fig/fig-standards/statuses/{sha}","languages_url":"https://api.github.com/repos/php-fig/fig-standards/languages","stargazers_url":"https://api.github.com/repos/php-fig/fig-standards/stargazers","contributors_url":"https://api.github.com/repos/php-fig/fig-standards/contributors","subscribers_url":"https://api.github.com/repos/php-fig/fig-standards/subscribers","subscription_url":"https://api.github.com/repos/php-fig/fig-standards/subscription","commits_url":"https://api.github.com/repos/php-fig/fig-standards/commits{/sha}","git_commits_url":"https://api.github.com/repos/php-fig/fig-standards/git/commits{/sha}","comments_url":"https://api.github.com/repos/php-fig/fig-standards/comments{/number}","issue_comment_url":"https://api.github.com/repos/php-fig/fig-standards/issues/comments{/number}","contents_url":"https://api.github.com/repos/php-fig/fig-standards/contents/{+path}","compare_url":"https://api.github.com/repos/php-fig/fig-standards/compare/{base}...{head}","merges_url":"https://api.github.com/repos/php-fig/fig-standards/merges","archive_url":"https://api.github.com/repos/php-fig/fig-standards/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/php-fig/fig-standards/downloads","issues_url":"https://api.github.com/repos/php-fig/fig-standards/issues{/number}","pulls_url":"https://api.github.com/repos/php-fig/fig-standards/pulls{/number}","milestones_url":"https://api.github.com/repos/php-fig/fig-standards/milestones{/number}","notifications_url":"https://api.github.com/repos/php-fig/fig-standards/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/php-fig/fig-standards/labels{/name}","releases_url":"https://api.github.com/repos/php-fig/fig-standards/releases{/id}","deployments_url":"https://api.github.com/repos/php-fig/fig-standards/deployments","created_at":"2010-11-05T04:44:12Z","updated_at":"2016-05-14T11:16:42Z","pushed_at":"2016-05-13T22:01:46Z","git_url":"git://github.com/php-fig/fig-standards.git","ssh_url":"git@github.com:php-fig/fig-standards.git","clone_url":"https://github.com/php-fig/fig-standards.git","svn_url":"https://github.com/php-fig/fig-standards","homepage":"http://www.php-fig.org/","size":3924,"stargazers_count":7777,"watchers_count":7777,"language":null,"has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2051,"mirror_url":null,"open_issues_count":14,"forks":2051,"open_issues":14,"watchers":7777,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/php-fig/fig-standards/pulls/755"},"html":{"href":"https://github.com/php-fig/fig-standards/pull/755"},"issue":{"href":"https://api.github.com/repos/php-fig/fig-standards/issues/755"},"comments":{"href":"https://api.github.com/repos/php-fig/fig-standards/issues/755/comments"},"review_comments":{"href":"https://api.github.com/repos/php-fig/fig-standards/pulls/755/comments"},"review_comment":{"href":"https://api.github.com/repos/php-fig/fig-standards/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/php-fig/fig-standards/pulls/755/commits"},"statuses":{"href":"https://api.github.com/repos/php-fig/fig-standards/statuses/71187c9afc596372ba4a15f0fd91bd43ed6bd11c"}}}}