{"id":25471165,"url":"https://github.com/maximkanet/php-router","last_synced_at":"2025-08-19T04:44:51.473Z","repository":{"id":205592203,"uuid":"714590524","full_name":"MaximkaNet/php-router","owner":"MaximkaNet","description":"Router for php application","archived":false,"fork":false,"pushed_at":"2023-11-10T19:24:59.000Z","size":6,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-17T17:39:47.466Z","etag":null,"topics":["php","php-router","router"],"latest_commit_sha":null,"homepage":"","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/MaximkaNet.png","metadata":{"files":{"readme":"README.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-11-05T10:21:25.000Z","updated_at":"2025-01-15T19:57:14.000Z","dependencies_parsed_at":"2023-11-10T20:29:00.446Z","dependency_job_id":null,"html_url":"https://github.com/MaximkaNet/php-router","commit_stats":null,"previous_names":["maximkanet/php-router"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/MaximkaNet/php-router","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MaximkaNet%2Fphp-router","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MaximkaNet%2Fphp-router/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MaximkaNet%2Fphp-router/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MaximkaNet%2Fphp-router/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MaximkaNet","download_url":"https://codeload.github.com/MaximkaNet/php-router/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MaximkaNet%2Fphp-router/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271103041,"owners_count":24699638,"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","status":"online","status_checked_at":"2025-08-19T02:00:09.176Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-router","router"],"created_at":"2025-02-18T09:36:45.008Z","updated_at":"2025-08-19T04:44:51.423Z","avatar_url":"https://github.com/MaximkaNet.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Simple php router\nIt is an easy-to-use router for your application in `php`.\n\n### Full documentation is available in `docs-\u003cversion\u003e` branch\n\n# Getting started\nBefore we start working with the router, we need to set up\nour application. To do this, we need to create a file in the root of the project\n`.htaccess` file in the root of the project, \nwhere we will write a few lines of code for the `Apache` server.\n```apacheconf\nRewriteEngine on\n\n# Ignore files\nRewriteCond %{REQUEST_FILENAME} !-f\nRewriteCond %{REQUEST_URI} !(\\.css|\\.html|\\.png|\\.gif|\\.jpeg)\n\n# Here we redirect all calls to the server \n# to the main file of the application.\nRewriteRule ^ index.php\n```\nThe next step is to initialize the router.\nTo do this, write the following code.\n```php\nuse router\\Router; // Connecting the router namespace\n```\nNext, create a new router using `new Router()`\n```php\n$router = new Router();\n```\nThe router has such methods as `get`, `post`, `put`, `patch`, `delete`.\nYou can use them as follows:\n```php\n$router-\u003eget('/', function () {\n    echo 'Hello world';\n});\n```\nThe next and last step is to start the router using the `resolve` method.\n```php\n$url = Router::getPath();\n$method = Router::getMethod();\n\n$router-\u003eresolve($url, $method);\n```\nIn the code above, we learned the `$method` and `$url` from the request.\nIt is not necessary to use the static methods `getPath()` and `getMethod()`,\nbut we recommend that you write these methods in your code to make it easier to\nunderstanding of the algorithm.\n\nThus, we have created an application that shows `Hello world` using the `Router` class.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaximkanet%2Fphp-router","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaximkanet%2Fphp-router","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaximkanet%2Fphp-router/lists"}