{"id":16771985,"url":"https://github.com/eddmann/rootr","last_synced_at":"2026-01-03T07:18:16.630Z","repository":{"id":17362855,"uuid":"20134582","full_name":"eddmann/rootr","owner":"eddmann","description":"Routing URLs like a boss.","archived":false,"fork":false,"pushed_at":"2014-06-02T12:19:20.000Z","size":280,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-23T03:26:44.727Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"jonedavis/TwilioOwlFinance","license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eddmann.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-05-24T16:50:16.000Z","updated_at":"2014-07-06T19:18:00.000Z","dependencies_parsed_at":"2022-09-04T17:40:50.509Z","dependency_job_id":null,"html_url":"https://github.com/eddmann/rootr","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eddmann%2Frootr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eddmann%2Frootr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eddmann%2Frootr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eddmann%2Frootr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eddmann","download_url":"https://codeload.github.com/eddmann/rootr/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243895832,"owners_count":20365281,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-13T06:29:36.941Z","updated_at":"2026-01-03T07:18:16.603Z","avatar_url":"https://github.com/eddmann.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"rootr\n=====\n\n_Routing URLs like a boss._\n\n[![Build Status](https://travis-ci.org/eddmann/rootr.svg?branch=master)](https://travis-ci.org/eddmann/rootr)\n[![Coverage Status](https://coveralls.io/repos/eddmann/rootr/badge.png?branch=master)](https://coveralls.io/r/eddmann/rootr?branch=master)\n[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/eddmann/rootr/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/eddmann/rootr/?branch=master)\n\n## Install\n\nGet composer:\n\n    wget http://getcomposer.org/composer.phar\n\nThen add this to a `composer.json` in your project's root:\n\n    {\n        \"require\": {\n            \"eddmann/rootr\": \"*\"\n        }\n    }\n\nNow install:\n\n    php composer.phar install\n\n## Closure Example\n\n```php\n\u003c?php\n\n$router = new Rootr\\Router;\n\n$router-\u003eget('/', function () {\n   return '/';\n});\n\n$router-\u003eget('/products', function () {\n    return '/products';\n});\n\n$router-\u003eget('/products/{id:\\d+}', function ($id) {\n   return \"/products/$id\";\n});\n\n$router-\u003eget('/products/show/{id:\\d+}/{?name}', function ($id, $name = 'na') {\n    return \"/products/show/$id/$name\";\n});\n\n$router-\u003eget('/product.json', function () {\n    $product = json_encode([ 'name' =\u003e 'Cheese', 'value' =\u003e 12.55 ]);\n\n    return (new Rootr\\Response(200, $product))-\u003easJson();\n});\n\n$dispatcher = new Rootr\\Dispatcher($router);\n\n$response = $dispatcher-\u003edispatch('GET', '/products/4');\n\n$response-\u003erender(); // /products/4\n```\n\n## Controller Example\n\n```php\n\u003c?php\n\n$router = new Rootr\\Router;\n\nclass ProductController extends Rootr\\Controller\n{\n    public function indexAction()\n    {\n        return '/products';\n    }\n\n    /**\n     * @method GET\n     * @route /{id:\\d+}\n     */\n    public function displayByIdAction($id)\n    {\n        return \"/products/$id\";\n    }\n\n    public function showAction($id, $name = 'na')\n    {\n        return \"/products/show/$id/$name\";\n    }\n}\n\n$router-\u003eget('/', function () {\n    return '/';\n});\n\n$router-\u003emountController('/products', 'ProductController');\n\n$dispatcher = new Rootr\\Dispatcher($router);\n\n$response = $dispatcher-\u003edispatch('GET', '/products/show/2/cheese');\n\n$response-\u003erender(); // /products/show/2/cheese\n```\n\n## Examples\n\nYou can run the examples using PHP's built-in web server by running the following:\n\n    ./examples.sh\n\n## Influenced By\n\n- [FastRoute](https://github.com/nikic/FastRoute)\n- [Pux](https://github.com/c9s/Pux)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feddmann%2Frootr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feddmann%2Frootr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feddmann%2Frootr/lists"}