{"id":22772902,"url":"https://github.com/baguettephp/tetorouting","last_synced_at":"2025-04-15T06:50:13.347Z","repository":{"id":26742934,"uuid":"30200631","full_name":"BaguettePHP/TetoRouting","owner":"BaguettePHP","description":"Simple routing for WebApp","archived":false,"fork":false,"pushed_at":"2023-07-31T12:34:54.000Z","size":691,"stargazers_count":21,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-15T06:50:06.830Z","etag":null,"topics":["baguette","packagist","php","teto-kasane","webapp","zonuexe"],"latest_commit_sha":null,"homepage":"https://packagist.org/packages/zonuexe/simple-routing","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BaguettePHP.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-02-02T18:09:38.000Z","updated_at":"2024-11-02T16:19:13.000Z","dependencies_parsed_at":"2024-06-19T06:11:43.172Z","dependency_job_id":"6f9f63e2-6835-4872-8b5b-ac3d88ccd684","html_url":"https://github.com/BaguettePHP/TetoRouting","commit_stats":{"total_commits":86,"total_committers":2,"mean_commits":43.0,"dds":"0.011627906976744207","last_synced_commit":"55abbe55dd6cf0b136655933a74a7c5d895d412c"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BaguettePHP%2FTetoRouting","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BaguettePHP%2FTetoRouting/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BaguettePHP%2FTetoRouting/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BaguettePHP%2FTetoRouting/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BaguettePHP","download_url":"https://codeload.github.com/BaguettePHP/TetoRouting/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249023708,"owners_count":21199958,"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":["baguette","packagist","php","teto-kasane","webapp","zonuexe"],"created_at":"2024-12-11T17:10:05.269Z","updated_at":"2025-04-15T06:50:13.325Z","avatar_url":"https://github.com/BaguettePHP.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"Teto Routing - PHP simple router\n================================\n\n[![Package version](http://img.shields.io/packagist/v/zonuexe/simple-routing.svg?style=flat)](https://packagist.org/packages/zonuexe/simple-routing)\n[![CI build status](https://github.com/BaguettePHP/TetoRouting/actions/workflows/CI.yml/badge.svg)](https://github.com/BaguettePHP/TetoRouting/actions/workflows/CI.yml)\n[![Packagist](http://img.shields.io/packagist/dt/zonuexe/simple-routing.svg?style=flat)](https://packagist.org/packages/zonuexe/simple-routing)\n\nSimple routing for WebApp\n\nNo *magic*.  No *reflection*.  No *complex dependency*.\n\nInstallation\n------------\n\n### Composer\n\n```\ncomposer require zonuexe/simple-routing\n```\n\nReferences\n----------\n\n* [API document](http://baguettephp.github.io/TetoRouting/namespace-Teto.Routing.html)\n* ja: [シンプルなルーティングがしたかった - Qiita](http://qiita.com/tadsan/items/bcaa14504d0ecdd9e096)\n\nRouting DSL\n-----------\n\n```php\n//    Method      Path           ReturnValue  Param =\u003e RegExp     extension (format)\n$routing_map = [\n    ['GET',      '/',            'index'  ],\n    ['GET|POST', '/search',      'search' ],\n    ['GET',      '/article/:id', 'article',  ['id' =\u003e '/\\A(\\d+)\\z/'], '?ext' =\u003e ['', 'txt']],\n    ['GET',      '/info',        'feed' ,                             '?ext' =\u003e ['rss', 'rdf', 'xml']],\n     '#404'       =\u003e             'not_found' // special\n];\n\n$router = new \\Teto\\Routing\\Router($routing_map);\n$action = $router-\u003ematch($_SERVER['REQUEST_METHOD'], $_SERVER['REQUEST_URI']);\n\n// Shorthand (but, do not use reverse routing)\n$action = \\Teto\\Routing\\Router::dispatch($routing_map, $_SERVER['REQUEST_METHOD'], $_SERVER['REQUEST_URI']);\n```\n\n### Reverse routing\n\n```php\n//   Name         Method      Path            ReturnValue  Param =\u003e RegExp     extension (file format)\n$routing_map = [\n    'root'    =\u003e ['GET',      '/',            'index'  ],\n    'search'  =\u003e ['GET|POST', '/search',      'search' ],\n    'article' =\u003e ['GET',      '/article/:id', 'article',  ['id' =\u003e '/\\A(\\d+)\\z/'], '?ext' =\u003e ['', 'txt']],\n    'info'    =\u003e ['GET',      '/info',        'feed' ,                             '?ext' =\u003e ['rss', 'rdf', 'xml']],\n    '#404'    =\u003e                              'not_found' // special\n];\n\n$router = new \\Teto\\Routing\\Router($routing_map);\n\n$router-\u003emakePath('root');    //=\u003e '/'\n$router-\u003emakePath('search');  //=\u003e '/search'\n$router-\u003emakePath('article', ['id' =\u003e 123]);     //=\u003e '/article/123'\n$router-\u003emakePath('info',    ['?ext' =\u003e 'rss']); //=\u003e '/info.rss'\n```\n\n### Tips\n\n```php\n$re_num_id    = '/\\A(\\d+)\\z/';\n$re_user_name = '/\\A@([a-z]+)\\z/';\n\n$routing_map = [\n    'root'    =\u003e ['GET', '/',            'index'  ],\n    'search'  =\u003e ['GET', '/search',      'search' ],\n    'article' =\u003e ['GET', '/article/:id', 'article',  ['id' =\u003e $re_num_id], '?ext' =\u003e ['', 'txt']],\n    '#404'    =\u003e                         'not_found' // special\n];\n```\n\nRelated Libraries\n-----------------\n\nYou can get these libraries from Packagist.\n\n* [HTTP Accept-Language](https://github.com/zonuexe/php-http-accept-language)\n  * [zonuexe/http-accept-language - Packagist](https://packagist.org/packages/zonuexe/http-accept-language)\n* [Teto Objectsystem](https://github.com/zonuexe/php-objectsystem)\n  * [zonuexe/objectsystem - Packagist](https://packagist.org/packages/zonuexe/objectsystem)\n* [Baguette PHP](https://github.com/BaguettePHP/baguette)\n  * [zonuexe/baguette](https://packagist.org/packages/zonuexe/baguette)\n\nCopyright\n---------\n\n**Teto\\\\Routing** is licensed under [Apache License Version 2.0](https://www.apache.org/licenses/LICENSE-2.0). See `./LICENSE`.\n\n    Teto Routing - PHP simple router for WebApp\n    Copyright (c) 2016 Baguette HQ / USAMI Kenta \u003ctadsan@zonu.me\u003e\n\nTeto Kasane\n-----------\n\nI love [Teto Kasane](http://utau.wikia.com/wiki/Teto_Kasane). (ja: [Teto Kasane official site](http://kasaneteto.jp/))\n\n```\n　　　　　 　r /\n　 ＿＿ , --ヽ!-- .､＿\n　! 　｀/::::;::::ヽ l\n　!二二!::／}::::丿ハﾆ|\n　!ﾆニ.|:／　ﾉ／ }::::}ｺ\n　L二lイ　　0´　0 ,':ﾉｺ\n　lヽﾉ/ﾍ､ ''　▽_ノイ ソ\n 　ソ´ ／}｀ｽ /￣￣￣￣/\n　　　.(_:;つ/  0401 /　ｶﾀｶﾀ\n ￣￣￣￣￣＼/＿＿＿＿/\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbaguettephp%2Ftetorouting","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbaguettephp%2Ftetorouting","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbaguettephp%2Ftetorouting/lists"}