{"action":"closed","number":62,"pull_request":{"url":"https://api.github.com/repos/zendframework/zend-expressive-helpers/pulls/62","id":192725105,"node_id":"MDExOlB1bGxSZXF1ZXN0MTkyNzI1MTA1","html_url":"https://github.com/zendframework/zend-expressive-helpers/pull/62","diff_url":"https://github.com/zendframework/zend-expressive-helpers/pull/62.diff","patch_url":"https://github.com/zendframework/zend-expressive-helpers/pull/62.patch","issue_url":"https://api.github.com/repos/zendframework/zend-expressive-helpers/issues/62","number":62,"state":"closed","locked":false,"title":"Allow varying `UrlHelper` for path-segregated middleware","user":{"login":"weierophinney","id":25943,"node_id":"MDQ6VXNlcjI1OTQz","avatar_url":"https://avatars1.githubusercontent.com/u/25943?v=4","gravatar_id":"","url":"https://api.github.com/users/weierophinney","html_url":"https://github.com/weierophinney","followers_url":"https://api.github.com/users/weierophinney/followers","following_url":"https://api.github.com/users/weierophinney/following{/other_user}","gists_url":"https://api.github.com/users/weierophinney/gists{/gist_id}","starred_url":"https://api.github.com/users/weierophinney/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/weierophinney/subscriptions","organizations_url":"https://api.github.com/users/weierophinney/orgs","repos_url":"https://api.github.com/users/weierophinney/repos","events_url":"https://api.github.com/users/weierophinney/events{/privacy}","received_events_url":"https://api.github.com/users/weierophinney/received_events","type":"User","site_admin":false},"body":"When creating path-segregated middleware, you may want to provide middleware-specific routing. Once you do that, however, you need a new `UrlHelper` instance that contains that new router, and which knows the base path to prepend, if you want to generate route-specific URIs.\r\n\r\nThis patch is the first of several that accommodates this scenario.\r\n\r\nThe approach it uses is to allow optional constructor arguments to each of the `UrlHelperFactory` and `UrlHelperMiddlewareFactory`. Usage is as follows:\r\n\r\n```php\r\n// in a ConfigProvider or config file:\r\nnamespace Api;\r\n\r\nuse Zend\\Expressive\\Helper\\UrlHelperFactory;\r\nuse Zend\\Expressive\\Helper\\UrlHelperMiddlewareFactory;\r\nuse Zend\\Expressive\\Router\\FastRouteRouter;\r\n\r\nreturn [\r\n    'dependencies' => [\r\n        'factories' => [\r\n            Router::class => FastRouteRouter::class,\r\n            UrlHelper::class => new UrlHelperFactory('/api', Router::class),\r\n            UrlHelperMiddleware::class => new UrlHelperMiddlewareFactory(UrlHelper::class),\r\n        ],\r\n    ],\r\n];\r\n```\r\n\r\nIn the above, `Router:class`, `UrlHelper::class`, and `UrlHelperMiddleware::class` are virtual services, resolving to the `Api` namespace. When creating our middleware pipeline, we can now reference the `UrlHelperMiddleware` service:\r\n\r\n```php\r\n$app->pipe('/api', [\r\n    Api\\UrlHelperMiddleware::class,\r\n    // ...\r\n]);\r\n```\r\n\r\nEach factory now also implements `__set_state()`, to ensure that configuration caching will work correctly (the default configuration caching uses `var_export()`, which requires that `__set_state()` be defined when `include` is called).","created_at":"2018-06-05T14:22:10Z","updated_at":"2018-06-05T15:21:55Z","closed_at":"2018-06-05T15:21:55Z","merged_at":"2018-06-05T15:21:55Z","merge_commit_sha":"97e5ec9fa320f51cfd0e3dc1e05603822e92b2c2","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/zendframework/zend-expressive-helpers/pulls/62/commits","review_comments_url":"https://api.github.com/repos/zendframework/zend-expressive-helpers/pulls/62/comments","review_comment_url":"https://api.github.com/repos/zendframework/zend-expressive-helpers/pulls/comments{/number}","comments_url":"https://api.github.com/repos/zendframework/zend-expressive-helpers/issues/62/comments","statuses_url":"https://api.github.com/repos/zendframework/zend-expressive-helpers/statuses/97e5ec9fa320f51cfd0e3dc1e05603822e92b2c2","head":{"label":"weierophinney:feature/allow-varying-factories","ref":"feature/allow-varying-factories","sha":"97e5ec9fa320f51cfd0e3dc1e05603822e92b2c2","user":{"login":"weierophinney","id":25943,"node_id":"MDQ6VXNlcjI1OTQz","avatar_url":"https://avatars1.githubusercontent.com/u/25943?v=4","gravatar_id":"","url":"https://api.github.com/users/weierophinney","html_url":"https://github.com/weierophinney","followers_url":"https://api.github.com/users/weierophinney/followers","following_url":"https://api.github.com/users/weierophinney/following{/other_user}","gists_url":"https://api.github.com/users/weierophinney/gists{/gist_id}","starred_url":"https://api.github.com/users/weierophinney/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/weierophinney/subscriptions","organizations_url":"https://api.github.com/users/weierophinney/orgs","repos_url":"https://api.github.com/users/weierophinney/repos","events_url":"https://api.github.com/users/weierophinney/events{/privacy}","received_events_url":"https://api.github.com/users/weierophinney/received_events","type":"User","site_admin":false},"repo":{"id":47513968,"node_id":"MDEwOlJlcG9zaXRvcnk0NzUxMzk2OA==","name":"zend-expressive-helpers","full_name":"weierophinney/zend-expressive-helpers","owner":{"login":"weierophinney","id":25943,"node_id":"MDQ6VXNlcjI1OTQz","avatar_url":"https://avatars1.githubusercontent.com/u/25943?v=4","gravatar_id":"","url":"https://api.github.com/users/weierophinney","html_url":"https://github.com/weierophinney","followers_url":"https://api.github.com/users/weierophinney/followers","following_url":"https://api.github.com/users/weierophinney/following{/other_user}","gists_url":"https://api.github.com/users/weierophinney/gists{/gist_id}","starred_url":"https://api.github.com/users/weierophinney/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/weierophinney/subscriptions","organizations_url":"https://api.github.com/users/weierophinney/orgs","repos_url":"https://api.github.com/users/weierophinney/repos","events_url":"https://api.github.com/users/weierophinney/events{/privacy}","received_events_url":"https://api.github.com/users/weierophinney/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/weierophinney/zend-expressive-helpers","description":"Helper classes for Expressive","fork":true,"url":"https://api.github.com/repos/weierophinney/zend-expressive-helpers","forks_url":"https://api.github.com/repos/weierophinney/zend-expressive-helpers/forks","keys_url":"https://api.github.com/repos/weierophinney/zend-expressive-helpers/keys{/key_id}","collaborators_url":"https://api.github.com/repos/weierophinney/zend-expressive-helpers/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/weierophinney/zend-expressive-helpers/teams","hooks_url":"https://api.github.com/repos/weierophinney/zend-expressive-helpers/hooks","issue_events_url":"https://api.github.com/repos/weierophinney/zend-expressive-helpers/issues/events{/number}","events_url":"https://api.github.com/repos/weierophinney/zend-expressive-helpers/events","assignees_url":"https://api.github.com/repos/weierophinney/zend-expressive-helpers/assignees{/user}","branches_url":"https://api.github.com/repos/weierophinney/zend-expressive-helpers/branches{/branch}","tags_url":"https://api.github.com/repos/weierophinney/zend-expressive-helpers/tags","blobs_url":"https://api.github.com/repos/weierophinney/zend-expressive-helpers/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/weierophinney/zend-expressive-helpers/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/weierophinney/zend-expressive-helpers/git/refs{/sha}","trees_url":"https://api.github.com/repos/weierophinney/zend-expressive-helpers/git/trees{/sha}","statuses_url":"https://api.github.com/repos/weierophinney/zend-expressive-helpers/statuses/{sha}","languages_url":"https://api.github.com/repos/weierophinney/zend-expressive-helpers/languages","stargazers_url":"https://api.github.com/repos/weierophinney/zend-expressive-helpers/stargazers","contributors_url":"https://api.github.com/repos/weierophinney/zend-expressive-helpers/contributors","subscribers_url":"https://api.github.com/repos/weierophinney/zend-expressive-helpers/subscribers","subscription_url":"https://api.github.com/repos/weierophinney/zend-expressive-helpers/subscription","commits_url":"https://api.github.com/repos/weierophinney/zend-expressive-helpers/commits{/sha}","git_commits_url":"https://api.github.com/repos/weierophinney/zend-expressive-helpers/git/commits{/sha}","comments_url":"https://api.github.com/repos/weierophinney/zend-expressive-helpers/comments{/number}","issue_comment_url":"https://api.github.com/repos/weierophinney/zend-expressive-helpers/issues/comments{/number}","contents_url":"https://api.github.com/repos/weierophinney/zend-expressive-helpers/contents/{+path}","compare_url":"https://api.github.com/repos/weierophinney/zend-expressive-helpers/compare/{base}...{head}","merges_url":"https://api.github.com/repos/weierophinney/zend-expressive-helpers/merges","archive_url":"https://api.github.com/repos/weierophinney/zend-expressive-helpers/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/weierophinney/zend-expressive-helpers/downloads","issues_url":"https://api.github.com/repos/weierophinney/zend-expressive-helpers/issues{/number}","pulls_url":"https://api.github.com/repos/weierophinney/zend-expressive-helpers/pulls{/number}","milestones_url":"https://api.github.com/repos/weierophinney/zend-expressive-helpers/milestones{/number}","notifications_url":"https://api.github.com/repos/weierophinney/zend-expressive-helpers/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/weierophinney/zend-expressive-helpers/labels{/name}","releases_url":"https://api.github.com/repos/weierophinney/zend-expressive-helpers/releases{/id}","deployments_url":"https://api.github.com/repos/weierophinney/zend-expressive-helpers/deployments","created_at":"2015-12-06T21:12:06Z","updated_at":"2015-12-06T21:12:07Z","pushed_at":"2018-06-05T15:20:44Z","git_url":"git://github.com/weierophinney/zend-expressive-helpers.git","ssh_url":"git@github.com:weierophinney/zend-expressive-helpers.git","clone_url":"https://github.com/weierophinney/zend-expressive-helpers.git","svn_url":"https://github.com/weierophinney/zend-expressive-helpers","homepage":null,"size":325,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":1,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"zendframework:develop","ref":"develop","sha":"45b60c9988f09336721c64645c2448553257735b","user":{"login":"zendframework","id":296074,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI5NjA3NA==","avatar_url":"https://avatars2.githubusercontent.com/u/296074?v=4","gravatar_id":"","url":"https://api.github.com/users/zendframework","html_url":"https://github.com/zendframework","followers_url":"https://api.github.com/users/zendframework/followers","following_url":"https://api.github.com/users/zendframework/following{/other_user}","gists_url":"https://api.github.com/users/zendframework/gists{/gist_id}","starred_url":"https://api.github.com/users/zendframework/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zendframework/subscriptions","organizations_url":"https://api.github.com/users/zendframework/orgs","repos_url":"https://api.github.com/users/zendframework/repos","events_url":"https://api.github.com/users/zendframework/events{/privacy}","received_events_url":"https://api.github.com/users/zendframework/received_events","type":"Organization","site_admin":false},"repo":{"id":47414911,"node_id":"MDEwOlJlcG9zaXRvcnk0NzQxNDkxMQ==","name":"zend-expressive-helpers","full_name":"zendframework/zend-expressive-helpers","owner":{"login":"zendframework","id":296074,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI5NjA3NA==","avatar_url":"https://avatars2.githubusercontent.com/u/296074?v=4","gravatar_id":"","url":"https://api.github.com/users/zendframework","html_url":"https://github.com/zendframework","followers_url":"https://api.github.com/users/zendframework/followers","following_url":"https://api.github.com/users/zendframework/following{/other_user}","gists_url":"https://api.github.com/users/zendframework/gists{/gist_id}","starred_url":"https://api.github.com/users/zendframework/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zendframework/subscriptions","organizations_url":"https://api.github.com/users/zendframework/orgs","repos_url":"https://api.github.com/users/zendframework/repos","events_url":"https://api.github.com/users/zendframework/events{/privacy}","received_events_url":"https://api.github.com/users/zendframework/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/zendframework/zend-expressive-helpers","description":"Helper classes for Expressive","fork":false,"url":"https://api.github.com/repos/zendframework/zend-expressive-helpers","forks_url":"https://api.github.com/repos/zendframework/zend-expressive-helpers/forks","keys_url":"https://api.github.com/repos/zendframework/zend-expressive-helpers/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zendframework/zend-expressive-helpers/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zendframework/zend-expressive-helpers/teams","hooks_url":"https://api.github.com/repos/zendframework/zend-expressive-helpers/hooks","issue_events_url":"https://api.github.com/repos/zendframework/zend-expressive-helpers/issues/events{/number}","events_url":"https://api.github.com/repos/zendframework/zend-expressive-helpers/events","assignees_url":"https://api.github.com/repos/zendframework/zend-expressive-helpers/assignees{/user}","branches_url":"https://api.github.com/repos/zendframework/zend-expressive-helpers/branches{/branch}","tags_url":"https://api.github.com/repos/zendframework/zend-expressive-helpers/tags","blobs_url":"https://api.github.com/repos/zendframework/zend-expressive-helpers/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zendframework/zend-expressive-helpers/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zendframework/zend-expressive-helpers/git/refs{/sha}","trees_url":"https://api.github.com/repos/zendframework/zend-expressive-helpers/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zendframework/zend-expressive-helpers/statuses/{sha}","languages_url":"https://api.github.com/repos/zendframework/zend-expressive-helpers/languages","stargazers_url":"https://api.github.com/repos/zendframework/zend-expressive-helpers/stargazers","contributors_url":"https://api.github.com/repos/zendframework/zend-expressive-helpers/contributors","subscribers_url":"https://api.github.com/repos/zendframework/zend-expressive-helpers/subscribers","subscription_url":"https://api.github.com/repos/zendframework/zend-expressive-helpers/subscription","commits_url":"https://api.github.com/repos/zendframework/zend-expressive-helpers/commits{/sha}","git_commits_url":"https://api.github.com/repos/zendframework/zend-expressive-helpers/git/commits{/sha}","comments_url":"https://api.github.com/repos/zendframework/zend-expressive-helpers/comments{/number}","issue_comment_url":"https://api.github.com/repos/zendframework/zend-expressive-helpers/issues/comments{/number}","contents_url":"https://api.github.com/repos/zendframework/zend-expressive-helpers/contents/{+path}","compare_url":"https://api.github.com/repos/zendframework/zend-expressive-helpers/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zendframework/zend-expressive-helpers/merges","archive_url":"https://api.github.com/repos/zendframework/zend-expressive-helpers/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zendframework/zend-expressive-helpers/downloads","issues_url":"https://api.github.com/repos/zendframework/zend-expressive-helpers/issues{/number}","pulls_url":"https://api.github.com/repos/zendframework/zend-expressive-helpers/pulls{/number}","milestones_url":"https://api.github.com/repos/zendframework/zend-expressive-helpers/milestones{/number}","notifications_url":"https://api.github.com/repos/zendframework/zend-expressive-helpers/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zendframework/zend-expressive-helpers/labels{/name}","releases_url":"https://api.github.com/repos/zendframework/zend-expressive-helpers/releases{/id}","deployments_url":"https://api.github.com/repos/zendframework/zend-expressive-helpers/deployments","created_at":"2015-12-04T16:16:30Z","updated_at":"2018-06-05T13:53:03Z","pushed_at":"2018-06-05T15:21:54Z","git_url":"git://github.com/zendframework/zend-expressive-helpers.git","ssh_url":"git@github.com:zendframework/zend-expressive-helpers.git","clone_url":"https://github.com/zendframework/zend-expressive-helpers.git","svn_url":"https://github.com/zendframework/zend-expressive-helpers","homepage":null,"size":338,"stargazers_count":29,"watchers_count":29,"language":"PHP","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":19,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":19,"open_issues":0,"watchers":29,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/zendframework/zend-expressive-helpers/pulls/62"},"html":{"href":"https://github.com/zendframework/zend-expressive-helpers/pull/62"},"issue":{"href":"https://api.github.com/repos/zendframework/zend-expressive-helpers/issues/62"},"comments":{"href":"https://api.github.com/repos/zendframework/zend-expressive-helpers/issues/62/comments"},"review_comments":{"href":"https://api.github.com/repos/zendframework/zend-expressive-helpers/pulls/62/comments"},"review_comment":{"href":"https://api.github.com/repos/zendframework/zend-expressive-helpers/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/zendframework/zend-expressive-helpers/pulls/62/commits"},"statuses":{"href":"https://api.github.com/repos/zendframework/zend-expressive-helpers/statuses/97e5ec9fa320f51cfd0e3dc1e05603822e92b2c2"}},"author_association":"MEMBER","merged":true,"mergeable":null,"rebaseable":null,"mergeable_state":"unknown","merged_by":{"login":"weierophinney","id":25943,"node_id":"MDQ6VXNlcjI1OTQz","avatar_url":"https://avatars1.githubusercontent.com/u/25943?v=4","gravatar_id":"","url":"https://api.github.com/users/weierophinney","html_url":"https://github.com/weierophinney","followers_url":"https://api.github.com/users/weierophinney/followers","following_url":"https://api.github.com/users/weierophinney/following{/other_user}","gists_url":"https://api.github.com/users/weierophinney/gists{/gist_id}","starred_url":"https://api.github.com/users/weierophinney/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/weierophinney/subscriptions","organizations_url":"https://api.github.com/users/weierophinney/orgs","repos_url":"https://api.github.com/users/weierophinney/repos","events_url":"https://api.github.com/users/weierophinney/events{/privacy}","received_events_url":"https://api.github.com/users/weierophinney/received_events","type":"User","site_admin":false},"comments":0,"review_comments":0,"maintainer_can_modify":false,"commits":3,"additions":120,"deletions":8,"changed_files":5}}
{"actor":{"display_login":"weierophinney"}}