{"id":16031578,"url":"https://github.com/razonyang/php-router","last_synced_at":"2025-07-18T07:07:33.397Z","repository":{"id":98816054,"uuid":"102084599","full_name":"razonyang/php-router","owner":"razonyang","description":"A fast and high scalable HTTP router for PHP","archived":false,"fork":false,"pushed_at":"2023-03-17T07:10:08.000Z","size":5,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-01T20:05:14.722Z","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":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/razonyang.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2017-09-01T07:11:48.000Z","updated_at":"2017-09-01T07:33:56.000Z","dependencies_parsed_at":"2023-06-08T20:00:40.220Z","dependency_job_id":null,"html_url":"https://github.com/razonyang/php-router","commit_stats":{"total_commits":4,"total_committers":1,"mean_commits":4.0,"dds":0.0,"last_synced_commit":"38c226ff1bcede967f237e671bb887549bb07fa5"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/razonyang/php-router","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/razonyang%2Fphp-router","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/razonyang%2Fphp-router/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/razonyang%2Fphp-router/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/razonyang%2Fphp-router/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/razonyang","download_url":"https://codeload.github.com/razonyang/php-router/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/razonyang%2Fphp-router/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264102176,"owners_count":23557714,"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-08T21:03:37.914Z","updated_at":"2025-07-18T07:07:33.368Z","avatar_url":"https://github.com/razonyang.png","language":"PHP","readme":"# PHP Router\r\n\r\nA fast and high scalable HTTP router for PHP.\r\n\r\n\r\n## Requirements\r\n\r\n- PHP \u003e= 5.4\r\n\r\n\r\n## Install\r\n\r\n```\r\ncomposer require razonyang/php-router:dev-master\r\n```\r\n\r\nPlease add the following repository into `repositories` when `composer` complains about\r\nthat `Could not find package razonyang/php-router ...`.\r\n\r\n```\r\n{\r\n    \"type\": \"git\",\r\n    \"url\": \"https://github.com/razonyang/php-router.git\"\r\n}\r\n```\r\n\r\n\r\n## Features\r\n\r\n- **Grouping router**\r\n- Friendly to **RESTful API**\r\n- No third-party library dependencies\r\n- High scalable\r\n\r\n\r\n## Usage\r\n\r\n```\r\nuse RazonYang\\Router\\Router;\r\n\r\n$router = new Router();\r\n\r\n$router-\u003ehandle('GET', '', 'homepage');\r\n\r\n// RESTful API\r\n$router-\u003eget('users', 'users list'); // GET \"users\" matched\r\n$router-\u003epost('users', 'create user account'); // POST \"users\" matched\r\n$router-\u003eget('users/\u003cusername\u003e', 'users profile'); // GET \"users/foo\" matched\r\n$router-\u003edelete('users/\u003cusername\u003e', 'delete user'); // DELETE \"users/bar\" matched\r\n$router-\u003eget('posts/\u003cpost_id:\\d+\u003e', 'post content'); // GET \"posts/1\" matched, GET \"posts/nan\" unmatched\r\n\r\n// Grouping\r\n$router-\u003egroup('admin', function (Router $group) {\r\n    $group-\u003eget('', 'admin dashboard');\r\n});\r\n\r\n// Dispatch request\r\n$requestMethod = 'GET';\r\n$requestPath = 'users/foo';\r\n\r\n// If matched, $route contains handler, params and settings, otherwise $route is null.\r\n// In this case:\r\n// $route = [\r\n//     'handler', // first elements\r\n//     'params', // second elements\r\n//     'settings', // third elements\r\n// ];\r\n$route = $router-\u003edispatch($requestMethod, $requestPath);\r\n```","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frazonyang%2Fphp-router","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frazonyang%2Fphp-router","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frazonyang%2Fphp-router/lists"}