{"id":20159639,"url":"https://github.com/co0lc0der/router-component","last_synced_at":"2026-06-05T18:31:08.473Z","repository":{"id":134638385,"uuid":"357547654","full_name":"co0lc0der/Router-component","owner":"co0lc0der","description":"Router php component","archived":false,"fork":false,"pushed_at":"2022-05-02T18:40:37.000Z","size":4,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-13T13:49:03.065Z","etag":null,"topics":["php","php-oop","router","routing"],"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/co0lc0der.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-04-13T12:37:49.000Z","updated_at":"2022-08-11T11:48:13.000Z","dependencies_parsed_at":null,"dependency_job_id":"8ce469a8-c42f-4a63-8a96-0dffff99482f","html_url":"https://github.com/co0lc0der/Router-component","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/co0lc0der%2FRouter-component","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/co0lc0der%2FRouter-component/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/co0lc0der%2FRouter-component/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/co0lc0der%2FRouter-component/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/co0lc0der","download_url":"https://codeload.github.com/co0lc0der/Router-component/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241597508,"owners_count":19988262,"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":["php","php-oop","router","routing"],"created_at":"2024-11-14T00:09:21.448Z","updated_at":"2026-06-05T18:31:08.468Z","avatar_url":"https://github.com/co0lc0der.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Router php component\n\nThis is easy-to-use php component for routing URLs in your project. See `index.php` for examples.\n### Public methods:\n- `run()` - runs routing\n## How to use\n### 1. Include config file and set `tplpath` parameter. Add routes into the section below.\n- `index.php`\n```php\n$config = require __DIR__ . '/Router/config.php';\n```\n- `config.php`\n```php\n'tplpath' =\u003e __DIR__ . '/../templates/',\n'routes' =\u003e [\n  '' =\u003e 'index',\n  '/login' =\u003e 'login',\n  '/profile' =\u003e 'profile',\n]\n```\n### 2. Create files according the routes you added.\nA file must be called `2nd_part_of_route.view.php`. For example we have a route `'/about'\t=\u003e 'about_us'` therefore the file must be `about_us.view.php` and be placed into `templates` folder (`tplpath` parameter). If a file cannot be found Router shows `404.view.php` from `templates` folder.\n```\ntemplates/\n  404.view.php\n  index.view.php\n  login.view.php\n```\n### 3. Include Router class and init it with `routes` array and `tplpath` from config.\n```php\nrequire __DIR__ . '/Router/Router.php';\n\n$router = new Router($config['routes'], $config['tplpath']);\n```\n### 4. Now just run it.\n```php\n$router-\u003erun();\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fco0lc0der%2Frouter-component","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fco0lc0der%2Frouter-component","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fco0lc0der%2Frouter-component/lists"}