{"action":"created","issue":{"url":"https://api.github.com/repos/slimphp/Slim/issues/1891","repository_url":"https://api.github.com/repos/slimphp/Slim","labels_url":"https://api.github.com/repos/slimphp/Slim/issues/1891/labels{/name}","comments_url":"https://api.github.com/repos/slimphp/Slim/issues/1891/comments","events_url":"https://api.github.com/repos/slimphp/Slim/issues/1891/events","html_url":"https://github.com/slimphp/Slim/issues/1891","id":156604255,"number":1891,"title":"Extend concept of route groups to route \"tags\"","user":{"login":"alexweissman","id":5004534,"avatar_url":"https://avatars.githubusercontent.com/u/5004534?v=3","gravatar_id":"","url":"https://api.github.com/users/alexweissman","html_url":"https://github.com/alexweissman","followers_url":"https://api.github.com/users/alexweissman/followers","following_url":"https://api.github.com/users/alexweissman/following{/other_user}","gists_url":"https://api.github.com/users/alexweissman/gists{/gist_id}","starred_url":"https://api.github.com/users/alexweissman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexweissman/subscriptions","organizations_url":"https://api.github.com/users/alexweissman/orgs","repos_url":"https://api.github.com/users/alexweissman/repos","events_url":"https://api.github.com/users/alexweissman/events{/privacy}","received_events_url":"https://api.github.com/users/alexweissman/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2016-05-24T20:42:19Z","updated_at":"2016-05-25T16:16:09Z","closed_at":null,"body":"It would be useful if we could extend the idea of route groups (which is a many-to-one relationship) to route tags.  For example:\r\n\r\n```\r\n        // Front page\r\n        $app->get('/', function (Request $request, Response $response, $args) {\r\n            ...\r\n        })->tag('page');\r\n    \r\n        // About page\r\n        $app->get('/about', function (Request $request, Response $response, $args) {\r\n            ... \r\n        })->tag('page');  \r\n\r\n        // Retrieve flash messages (JSON format)\r\n        $app->get('/flash-messages', function (Request $request, Response $response, $args) {\r\n            ...\r\n        })->tag('api', 'messages');\r\n    \r\n        // Log the user out\r\n        $app->get('/logout', function (Request $request, Response $response, $args) {\r\n            ...\r\n        })->tag('api', 'auth'); \r\n```\r\n\r\nThese tags could then be used in middleware for more advanced filtering:\r\n\r\n```\r\n    $route = $request->getAttribute('route');\r\n    if ($route->hasTag('auth'){\r\n        // Do something only for auth-related requests\r\n    }\r\n```"},"comment":{"url":"https://api.github.com/repos/slimphp/Slim/issues/comments/221627410","html_url":"https://github.com/slimphp/Slim/issues/1891#issuecomment-221627410","issue_url":"https://api.github.com/repos/slimphp/Slim/issues/1891","id":221627410,"user":{"login":"danielgsims","id":695933,"avatar_url":"https://avatars.githubusercontent.com/u/695933?v=3","gravatar_id":"","url":"https://api.github.com/users/danielgsims","html_url":"https://github.com/danielgsims","followers_url":"https://api.github.com/users/danielgsims/followers","following_url":"https://api.github.com/users/danielgsims/following{/other_user}","gists_url":"https://api.github.com/users/danielgsims/gists{/gist_id}","starred_url":"https://api.github.com/users/danielgsims/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danielgsims/subscriptions","organizations_url":"https://api.github.com/users/danielgsims/orgs","repos_url":"https://api.github.com/users/danielgsims/repos","events_url":"https://api.github.com/users/danielgsims/events{/privacy}","received_events_url":"https://api.github.com/users/danielgsims/received_events","type":"User","site_admin":false},"created_at":"2016-05-25T16:16:09Z","updated_at":"2016-05-25T16:16:09Z","body":"@RyanGittins example makes sense. This is behavior that you can already accomplish, but not easily, and using tags might just be convenient to clean up some code bases and organize it, slightly differently than groups.\r\n\r\n@alexweissman brought up the idea that maybe a key-value store would be better than a list of tags. What does everyone think about that?\r\n\r\n"}}
{"actor":{"display_login":"danielgsims"}}