PHPackages                             zonuexe/simple-routing - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. zonuexe/simple-routing

ActiveLibrary[Framework](/categories/framework)

zonuexe/simple-routing
======================

Simple Web Application Router

0.6.0(2y ago)2113.6k↓26.5%2[1 issues](https://github.com/BaguettePHP/TetoRouting/issues)4Apache-2.0PHPPHP &gt;=5.6

Since Feb 3Pushed 2y ago2 watchersCompare

[ Source](https://github.com/BaguettePHP/TetoRouting)[ Packagist](https://packagist.org/packages/zonuexe/simple-routing)[ RSS](/packages/zonuexe-simple-routing/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (3)Versions (18)Used By (4)

Teto Routing - PHP simple router
================================

[](#teto-routing---php-simple-router)

[![Package version](https://camo.githubusercontent.com/aaddc98ae4ef7b3b842b21ef75fd5d01cf829091a202c34787e7a65214f160e1/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7a6f6e756578652f73696d706c652d726f7574696e672e7376673f7374796c653d666c6174)](https://packagist.org/packages/zonuexe/simple-routing)[![CI build status](https://github.com/BaguettePHP/TetoRouting/actions/workflows/CI.yml/badge.svg)](https://github.com/BaguettePHP/TetoRouting/actions/workflows/CI.yml)[![Packagist](https://camo.githubusercontent.com/8a972a2aaec8d34b8510dd90f6051286f1fc6a58e0eaa85ad4c6863d5f2d57d9/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7a6f6e756578652f73696d706c652d726f7574696e672e7376673f7374796c653d666c6174)](https://packagist.org/packages/zonuexe/simple-routing)

Simple routing for WebApp

No *magic*. No *reflection*. No *complex dependency*.

Installation
------------

[](#installation)

### Composer

[](#composer)

```
composer require zonuexe/simple-routing

```

References
----------

[](#references)

- [API document](http://baguettephp.github.io/TetoRouting/namespace-Teto.Routing.html)
- ja: [シンプルなルーティングがしたかった - Qiita](http://qiita.com/tadsan/items/bcaa14504d0ecdd9e096)

Routing DSL
-----------

[](#routing-dsl)

```
//    Method      Path           ReturnValue  Param => RegExp     extension (format)
$routing_map = [
    ['GET',      '/',            'index'  ],
    ['GET|POST', '/search',      'search' ],
    ['GET',      '/article/:id', 'article',  ['id' => '/\A(\d+)\z/'], '?ext' => ['', 'txt']],
    ['GET',      '/info',        'feed' ,                             '?ext' => ['rss', 'rdf', 'xml']],
     '#404'       =>             'not_found' // special
];

$router = new \Teto\Routing\Router($routing_map);
$action = $router->match($_SERVER['REQUEST_METHOD'], $_SERVER['REQUEST_URI']);

// Shorthand (but, do not use reverse routing)
$action = \Teto\Routing\Router::dispatch($routing_map, $_SERVER['REQUEST_METHOD'], $_SERVER['REQUEST_URI']);
```

### Reverse routing

[](#reverse-routing)

```
//   Name         Method      Path            ReturnValue  Param => RegExp     extension (file format)
$routing_map = [
    'root'    => ['GET',      '/',            'index'  ],
    'search'  => ['GET|POST', '/search',      'search' ],
    'article' => ['GET',      '/article/:id', 'article',  ['id' => '/\A(\d+)\z/'], '?ext' => ['', 'txt']],
    'info'    => ['GET',      '/info',        'feed' ,                             '?ext' => ['rss', 'rdf', 'xml']],
    '#404'    =>                              'not_found' // special
];

$router = new \Teto\Routing\Router($routing_map);

$router->makePath('root');    //=> '/'
$router->makePath('search');  //=> '/search'
$router->makePath('article', ['id' => 123]);     //=> '/article/123'
$router->makePath('info',    ['?ext' => 'rss']); //=> '/info.rss'
```

### Tips

[](#tips)

```
$re_num_id    = '/\A(\d+)\z/';
$re_user_name = '/\A@([a-z]+)\z/';

$routing_map = [
    'root'    => ['GET', '/',            'index'  ],
    'search'  => ['GET', '/search',      'search' ],
    'article' => ['GET', '/article/:id', 'article',  ['id' => $re_num_id], '?ext' => ['', 'txt']],
    '#404'    =>                         'not_found' // special
];
```

Related Libraries
-----------------

[](#related-libraries)

You can get these libraries from Packagist.

- [HTTP Accept-Language](https://github.com/zonuexe/php-http-accept-language)
    - [zonuexe/http-accept-language - Packagist](https://packagist.org/packages/zonuexe/http-accept-language)
- [Teto Objectsystem](https://github.com/zonuexe/php-objectsystem)
    - [zonuexe/objectsystem - Packagist](https://packagist.org/packages/zonuexe/objectsystem)
- [Baguette PHP](https://github.com/BaguettePHP/baguette)
    - [zonuexe/baguette](https://packagist.org/packages/zonuexe/baguette)

Copyright
---------

[](#copyright)

**Teto\\Routing** is licensed under [Apache License Version 2.0](https://www.apache.org/licenses/LICENSE-2.0). See `./LICENSE`.

```
Teto Routing - PHP simple router for WebApp
Copyright (c) 2016 Baguette HQ / USAMI Kenta

```

Teto Kasane
-----------

[](#teto-kasane)

I love [Teto Kasane](http://utau.wikia.com/wiki/Teto_Kasane). (ja: [Teto Kasane official site](http://kasaneteto.jp/))

```
　　　　　 　r /
　 ＿＿ , --ヽ!-- .､＿
　! 　｀/::::;::::ヽ l
　!二二!::／}::::丿ハﾆ|
　!ﾆニ.|:／　ﾉ／ }::::}ｺ
　L二lイ　　0´　0 ,':ﾉｺ
　lヽﾉ/ﾍ､ ''　▽_ノイ ソ
 　ソ´ ／}｀ｽ /￣￣￣￣/
　　　.(_:;つ/  0401 /　ｶﾀｶﾀ
 ￣￣￣￣￣＼/＿＿＿＿/

```

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity35

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 98.9% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~221 days

Recently: every ~680 days

Total

15

Last Release

1022d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e1cc4bc1729b858086681a12494fda6cced8f26db3d0928ae4d81c68ddf8dc06?d=identicon)[zonuexe](/maintainers/zonuexe)

---

Top Contributors

[![zonuexe](https://avatars.githubusercontent.com/u/822086?v=4)](https://github.com/zonuexe "zonuexe (88 commits)")[![gitter-badger](https://avatars.githubusercontent.com/u/8518239?v=4)](https://github.com/gitter-badger "gitter-badger (1 commits)")

---

Tags

baguettepackagistphpteto-kasanewebappzonuexerouter

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/zonuexe-simple-routing/health.svg)

```
[![Health](https://phpackages.com/badges/zonuexe-simple-routing/health.svg)](https://phpackages.com/packages/zonuexe-simple-routing)
```

###  Alternatives

[slim/slim

Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs

12.3k49.9M1.3k](/packages/slim-slim)[klein/klein

A lightning fast router for PHP

2.7k1.1M31](/packages/klein-klein)[slim/slim-skeleton

A Slim Framework skeleton application for rapid development

1.6k458.7k6](/packages/slim-slim-skeleton)[pecee/simple-router

Simple, fast PHP router that is easy to get integrated and in almost any project. Heavily inspired by the Laravel router.

696214.6k17](/packages/pecee-simple-router)[rareloop/router

A powerful PHP Router for PSR7 messages inspired by the Laravel API

92178.9k4](/packages/rareloop-router)[yiisoft/router

Yii router

62321.8k21](/packages/yiisoft-router)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
