{"id":21899144,"url":"https://github.com/anhoder/imi-route","last_synced_at":"2026-05-19T15:03:26.996Z","repository":{"id":56943606,"uuid":"267273678","full_name":"anhoder/imi-route","owner":"anhoder","description":"The library enables the IMI framework to support the management of routes through PHP files.","archived":false,"fork":false,"pushed_at":"2020-06-27T16:35:31.000Z","size":5,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-27T06:15:11.822Z","etag":null,"topics":["imi","php","route","router","routers","routes"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/anhoder.png","metadata":{"files":{"readme":"README-en.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":"2020-05-27T09:13:53.000Z","updated_at":"2020-07-05T01:59:22.000Z","dependencies_parsed_at":"2022-08-21T02:10:21.752Z","dependency_job_id":null,"html_url":"https://github.com/anhoder/imi-route","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anhoder%2Fimi-route","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anhoder%2Fimi-route/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anhoder%2Fimi-route/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anhoder%2Fimi-route/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/anhoder","download_url":"https://codeload.github.com/anhoder/imi-route/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244911535,"owners_count":20530641,"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":["imi","php","route","router","routers","routes"],"created_at":"2024-11-28T14:38:15.720Z","updated_at":"2026-05-19T15:03:26.889Z","avatar_url":"https://github.com/anhoder.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# imi-route\n\n[中文](./README.md) | English\n\nThe library enables the IMI framework to support the management of routes through PHP files.\n\n## Usage\n\n1. Install package\n\n```sh\ncomposer require alanalbert/imi-route\n```\n\n2. Add code \n\nAdd the following code to the `/project/Main.php` file:\n\n```php\n\u003c?php\nnamespace ImiApp;\n\nuse Imi\\Main\\AppBaseMain;\n\nclass Main extends AppBaseMain\n{\n    public function __init()\n    {\n        \\Alan\\ImiRoute\\Route::init(); // Add this line\n    }\n\n}\n```\n\n3. Create `route.php` file\n\nCreate `/project/route/route.php` file(and dir).\n\nAnd then, you can manage your routes through PHP files. For example:\n\n```php\n/**\n * @var $router Route\n */\n\nuse Alan\\ImiRoute\\Route;\nuse ImiApp\\ApiServer\\Controller\\IndexController;\nuse ImiApp\\ApiServer\\Middleware\\Test2Middleware;\nuse ImiApp\\ApiServer\\Middleware\\TestMiddleware;\n\n$router-\u003egroup(['middleware' =\u003e TestMiddleware::class], function (Route $router) {\n\n    $router-\u003egroup(\n        [\n            'middleware' =\u003e Test2Middleware::class, \n            'ignoreCase' =\u003e true, \n            'prefix' =\u003e 'prefix'\n        ], function (Route $router) {\n        $router-\u003eget('hi', 'ImiApp\\ApiServer\\Controller\\IndexController@index');\n    });\n\n    $router-\u003eany('/hi/api/abc', [IndexController::class, 'index']);\n\n    $router-\u003eany('/hi/api/{time}', [IndexController::class, 'api']);\n\n});\n\n$router-\u003egroup(['prefix' =\u003e 'prefix'], function (Route $router) {\n    $router-\u003eget('/TEST/{time}', [IndexController::class, 'api']);\n});\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanhoder%2Fimi-route","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanhoder%2Fimi-route","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanhoder%2Fimi-route/lists"}