{"action":"created","issue":{"url":"https://api.github.com/repos/mrjgreen/phroute/issues/28","labels_url":"https://api.github.com/repos/mrjgreen/phroute/issues/28/labels{/name}","comments_url":"https://api.github.com/repos/mrjgreen/phroute/issues/28/comments","events_url":"https://api.github.com/repos/mrjgreen/phroute/issues/28/events","html_url":"https://github.com/mrjgreen/phroute/issues/28","id":99256743,"number":28,"title":"Controllers Routing","user":{"login":"TCB13","id":6315832,"avatar_url":"https://avatars.githubusercontent.com/u/6315832?v=3","gravatar_id":"","url":"https://api.github.com/users/TCB13","html_url":"https://github.com/TCB13","followers_url":"https://api.github.com/users/TCB13/followers","following_url":"https://api.github.com/users/TCB13/following{/other_user}","gists_url":"https://api.github.com/users/TCB13/gists{/gist_id}","starred_url":"https://api.github.com/users/TCB13/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TCB13/subscriptions","organizations_url":"https://api.github.com/users/TCB13/orgs","repos_url":"https://api.github.com/users/TCB13/repos","events_url":"https://api.github.com/users/TCB13/events{/privacy}","received_events_url":"https://api.github.com/users/TCB13/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-08-05T17:22:13Z","updated_at":"2015-08-05T18:29:55Z","closed_at":null,"body":"Hello,\r\n\r\nI was trying to setup a controller like explained here: https://github.com/mrjgreen/phroute#controllers\r\n\r\nBut it doesn't work properly. It always ends up on the `anyIndex()` method and ignores the for example `postTest()` if I set my method to `POST`. If I remove the `anyIndex()` method it doesn't work.\r\n\r\nIs this poorly implemented or I'm using it the wrong way?"},"comment":{"url":"https://api.github.com/repos/mrjgreen/phroute/issues/comments/128100700","html_url":"https://github.com/mrjgreen/phroute/issues/28#issuecomment-128100700","issue_url":"https://api.github.com/repos/mrjgreen/phroute/issues/28","id":128100700,"user":{"login":"mrjgreen","id":2183391,"avatar_url":"https://avatars.githubusercontent.com/u/2183391?v=3","gravatar_id":"","url":"https://api.github.com/users/mrjgreen","html_url":"https://github.com/mrjgreen","followers_url":"https://api.github.com/users/mrjgreen/followers","following_url":"https://api.github.com/users/mrjgreen/following{/other_user}","gists_url":"https://api.github.com/users/mrjgreen/gists{/gist_id}","starred_url":"https://api.github.com/users/mrjgreen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrjgreen/subscriptions","organizations_url":"https://api.github.com/users/mrjgreen/orgs","repos_url":"https://api.github.com/users/mrjgreen/repos","events_url":"https://api.github.com/users/mrjgreen/events{/privacy}","received_events_url":"https://api.github.com/users/mrjgreen/received_events","type":"User","site_admin":false},"created_at":"2015-08-05T18:29:55Z","updated_at":"2015-08-05T18:29:55Z","body":"I may be wrong, but it seems that what you may be trying to do is really:\r\n\r\n~~~PHP\r\n$router->controller('/', \"$ns\\\\Page\");\r\n\r\nclass Page {\r\n\r\n    public function anyIndex() {\r\n        return \"PAGE - ANY index\";\r\n    }\r\n\r\n    public function getPage(){\r\n        return 'PAGE - GET method';\r\n    }\r\n}\r\n\r\n\r\n#Dispatch\r\n\r\n$dispatcher = (new Dispatcher($router->getData()));\r\n\r\n$dispatcher->dispatch('GET', '/'); //PAGE - ANY index\r\n$dispatcher->dispatch('PUT', '/'); //PAGE - ANY index\r\n$dispatcher->dispatch('POST', '/'); //PAGE - ANY index\r\n\r\n$dispatcher->dispatch('GET', '/page'); //PAGE - GET method\r\n~~~"}}