{"id":16616523,"url":"https://github.com/parable-php/routing","last_synced_at":"2025-10-16T11:12:10.130Z","repository":{"id":57035814,"uuid":"174529514","full_name":"parable-php/routing","owner":"parable-php","description":"Parable Routing is a fast, intuitive url routing library.","archived":false,"fork":false,"pushed_at":"2024-01-24T13:44:55.000Z","size":29,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-02T04:31:43.359Z","etag":null,"topics":["library","parable","php8","routes","routing","url"],"latest_commit_sha":null,"homepage":"","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/parable-php.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-03-08T11:54:35.000Z","updated_at":"2021-03-12T15:24:55.000Z","dependencies_parsed_at":"2022-08-23T21:00:09.151Z","dependency_job_id":null,"html_url":"https://github.com/parable-php/routing","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parable-php%2Frouting","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parable-php%2Frouting/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parable-php%2Frouting/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parable-php%2Frouting/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/parable-php","download_url":"https://codeload.github.com/parable-php/routing/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238874462,"owners_count":19545195,"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":["library","parable","php8","routes","routing","url"],"created_at":"2024-10-12T02:13:22.134Z","updated_at":"2025-10-16T11:12:05.072Z","avatar_url":"https://github.com/parable-php.png","language":"PHP","readme":"# Parable Routing\n\n[![Workflow Status](https://github.com/parable-php/routing/workflows/Tests/badge.svg)](https://github.com/parable-php/routing/actions?query=workflow%3ATests)\n[![Latest Stable Version](https://poser.pugx.org/parable-php/routing/v/stable)](https://packagist.org/packages/parable-php/routing)\n[![Latest Unstable Version](https://poser.pugx.org/parable-php/routing/v/unstable)](https://packagist.org/packages/parable-php/routing)\n[![License](https://poser.pugx.org/parable-php/routing/license)](https://packagist.org/packages/parable-php/routing)\n\nParable Routing is a fast, intuitive url routing library.\n\n## Install\n\nPhp 8.0+ and [composer](https://getcomposer.org) are required.\n\n```bash\n$ composer require parable-php/routing\n```\n\n## Usage\n\n```php\n$router = new Router();\n\n$route1 = new Route(\n    ['GET'],\n    'simple-route',\n    'route/simple',\n    [Controller::class, 'actionName']\n);\n\n$route2 = new Route(\n    ['GET', 'POST'],\n    'param-route',\n    'route/{param}/hello',\n    function (string $param) {\n        echo 'Hello, ' . $username . '!';\n    }\n);\n\n$router-\u003eaddRoutes($route1, $route2);\n\n$match = $router-\u003ematch('GET', 'route/devvoh/hello');\n\necho $match-\u003egetName();\n```\n\nThis would echo `param-route`.\n\nRouting does not provide a direct way of executing a route, but it's easy enough:\n\n```php\n$callable = $match-\u003egetCallable();\n$callable(...$match-\u003egetParameterValues()-\u003egetAll());\n```\n\nFor more free-form metadata you want to attach to a `Route`, you can use metadata:\n\n```php\n$route = new Route(\n    ['GET'],\n    'simple-route',\n    'route/simple',\n    [Controller::class, 'actionName'],\n    [\n        'metadata' =\u003e 'enabled'\n    ]\n);\n\n$route-\u003egetMetadataValue('metadata'); // returns 'enabled'\n```\n\nYou can use this to add template paths to a route, whether it should be visible to admins only, etc.\n\n## Contributing\n\nAny suggestions, bug reports or general feedback is welcome. Use github issues and pull requests, or find me over at [devvoh.com](https://devvoh.com).\n\n## License\n\nAll Parable components are open-source software, licensed under the MIT license.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparable-php%2Frouting","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fparable-php%2Frouting","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparable-php%2Frouting/lists"}