{"id":15698333,"url":"https://github.com/ryan-mahoney/route","last_synced_at":"2025-12-18T02:49:43.417Z","repository":{"id":14823869,"uuid":"17546544","full_name":"ryan-mahoney/Route","owner":"ryan-mahoney","description":"Backend PHP Router driven by YAML configuration files and dependency injection.","archived":false,"fork":false,"pushed_at":"2016-12-14T00:41:25.000Z","size":69,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-05-09T01:14:23.117Z","etag":null,"topics":["fastroute","php","router","yaml"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"tilezen/vector-datasource","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ryan-mahoney.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}},"created_at":"2014-03-08T17:05:52.000Z","updated_at":"2020-11-10T00:02:19.000Z","dependencies_parsed_at":"2022-08-23T20:50:24.289Z","dependency_job_id":null,"html_url":"https://github.com/ryan-mahoney/Route","commit_stats":null,"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"purl":"pkg:github/ryan-mahoney/Route","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryan-mahoney%2FRoute","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryan-mahoney%2FRoute/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryan-mahoney%2FRoute/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryan-mahoney%2FRoute/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ryan-mahoney","download_url":"https://codeload.github.com/ryan-mahoney/Route/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryan-mahoney%2FRoute/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260482135,"owners_count":23015860,"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":["fastroute","php","router","yaml"],"created_at":"2024-10-03T19:25:53.480Z","updated_at":"2025-12-18T02:49:43.331Z","avatar_url":"https://github.com/ryan-mahoney.png","language":"PHP","readme":"Opine\\Route\n===========\n\nService wrapper for FastRoute providing a more slim-like interface.\n\n[![Stories in Ready](https://badge.waffle.io/Opine-Org/Route.png?label=ready\u0026title=Ready)](https://waffle.io/Opine-Org/Route)\n\n[![Build Status](https://travis-ci.org/Opine-Org/Route.png?branch=master)](https://travis-ci.org/Opine-Org/Route)\n\n[![Scrutinizer Quality Score](https://scrutinizer-ci.com/g/Opine-Org/Route/badges/quality-score.png?s=345960c961c6d6da9788d4238c2f9c2a90a29a84)](https://scrutinizer-ci.com/g/Opine-Org/Route/)\n\n[![Code Coverage](https://scrutinizer-ci.com/g/Opine-Org/Route/badges/coverage.png?s=a8bb5c9fd7b98c7c4debb4d88e1064ee5e48f3c4)](https://scrutinizer-ci.com/g/Opine-Org/Route/)\n\n## Background\n\n[FastRoute](https://github.com/nikic/FastRoute) is an extremely fast PHP routing library.\n\nOpine\\Route is a service wrapper that makes it easy to define routes via a YAML file, cache routes and execute them.\n\n## Route Sample\n\n```yaml\nroute:\n    GET:\n        /sample:                            controller@sampleOutput\n        /api/add:                           controller@sampleOutput\n        /api/edit:                          controller@sampleOutput\n        /api/list:                          controller@sampleOutput\n        /api/upload:                        controller@sampleOutput\n        /api/upload/file:                   controller@sampleOutput\n        /api/upload/file/{name}:            controller@sampleOutput2\n        /api2/add:                          [controller@sampleOutput, {before: controller@beforeFilter, after: controller@afterFilter}]\n        /api2/edit:                         [controller@sampleOutput, {before: controller@beforeFilter, after: controller@afterFilter}]\n        /api2/list:                         [controller@sampleOutput, {before: controller@beforeFilter, after: controller@afterFilter}]\n        /api2/upload:                       [controller@sampleOutput, {before: controller@beforeFilter, after: controller@afterFilter}]\n        /api2/upload/file:                  [controller@sampleOutput, {before: controller@beforeFilter, after: controller@afterFilter}]\n        /api2/upload/file/{name}:           [controller@sampleOutput2, {before: controller@beforeFilter, after: controller@afterFilter}]\n        /sample2:                           [controller@sampleOutput, {name: Sample}]\n        /sample3/{name}:                    [controller@sampleOutput2, {name: SampleParam}]\n        /sample3/{name}/{age}/{location}:   [controller@sampleOutput3, {name: SampleParamAssoc}]\n        /redirect:                          controller@sampleRedirect\n```\n\n## Load / Execute Routes\n\n```php\n$routeFile = '/var/www/project/config/routes/route.yml';\n$containerFile = '/var/www/project/config/containers/container.yml';\n$webroot = '/var/www/project/public';\n$config = new \\Opine\\Config\\Service($webroot);\n$config-\u003ecacheSet();\n$container = \\Opine\\Container\\Service::instance($webroot, $config, $containerFile);\n$routeService = new Opine\\Route\\Service($webroot, $container);\n$routeModel = new Opine\\Route\\Model($webroot, $routeService);\n$routeModel-\u003eyaml($routeFile);\n$response = $this-\u003eroute-\u003erun('GET', '/sample');\nvar_dump($response);\n```\n\n\n## Installation\n```sh\ncomposer require \"opine/route:dev-master\"\ncomposer install\n```\n\n## Author\n\nRyan Mahoney can be reached at ryan@virtuecenter.com or @vcryan on Twitter.","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryan-mahoney%2Froute","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fryan-mahoney%2Froute","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryan-mahoney%2Froute/lists"}