PHPackages                             esase/tiny-router - 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. esase/tiny-router

ActiveLibrary[Framework](/categories/framework)

esase/tiny-router
=================

Flexible routing system component for HTTP and console applications

v1.0.5(5y ago)1841[2 PRs](https://github.com/esase/tiny-router/pulls)MITPHPPHP ^7.4 || ^8.0

Since Aug 2Pushed 3y ago2 watchersCompare

[ Source](https://github.com/esase/tiny-router)[ Packagist](https://packagist.org/packages/esase/tiny-router)[ RSS](/packages/esase-tiny-router/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (7)Dependencies (3)Versions (10)Used By (0)

tiny-router
===========

[](#tiny-router)

[![Build Status](https://camo.githubusercontent.com/82b718bf3e4c4d97079e1a45f50ad6bdb3b93799cea3618eadb5d0bd8440abb8/68747470733a2f2f7472617669732d63692e636f6d2f65736173652f74696e792d726f757465722e7376673f6272616e63683d6d6173746572)](https://travis-ci.com/github/esase/tiny-router/builds)[![Coverage Status](https://camo.githubusercontent.com/632b3648bb176485ab738e931c93ac3bac78c8fa27736a9e7cbe1413e483b95d/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f65736173652f74696e792d726f757465722f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/esase/tiny-router?branch=master)

**Tiny/Routing** - it's a layer between the outside world like a browser or a console command [CLI](https://en.wikipedia.org/wiki/Command-line_interface)and your application. The package may be integrated to any existing `php` project and it does not require any extra packages.

**Usually routing contains of two main parts:**

1. `Routes` - which describe a meta information like - a `query`, a query `type`, and a responsible `controller` which processes all incoming requests.
2. A `Router` - just holds registered routes and matches incoming requests with registered routes.
    So it just returns either a matched route or trigger an `Exception` when a route is not found.

Current implementation of routing is very simple but in the same time very powerful. It gets you a possibility to work with it using a plain requests (`literal`) and [Regexp](https://en.wikipedia.org/wiki/Regular_expression) based requests, also it supports filtering requests by http requests types like: `GET`, `POST`, etc.
Also you can use it as a routing for you `CLI` projects.

**So let's check a look an http routing example:**

```
    // create an instance of the router
    $router = new Router(new RequestHttpParams($_SERVER));

    // a literal `home` route
    $router->registerRoute(new Route(
        '/',
        'HomeController',
        'index'
    ));

    // a literal `users` route which accepts only `GET` and `POST` requests
    $router->registerRoute(new Route(
        '/users',
        'UserController',
        // list of actions
        [
            'GET' => 'list',
            'POST' => 'create'
        ]
    ));

    // a more complex example using a `RegExp` rule
    $router->registerRoute(new Route(
        '|^/users/(?P\d+)$|i', // it's matches to: `/users/1`, `/users/300`, etc
        'UserController',
        [
            'GET' => 'view',
            'DELETE' => 'delete',
        ],
        'regexp',
        ['id']
    ));

    // now get a matched route
    $matchedRoutes = $router->getMatchedRoute();
```

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

[](#installation)

Run the following to install this library:

```
$ composer require esase/tiny-router
```

Documentation
-------------

[](#documentation)

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~6 days

Total

7

Last Release

2075d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3234529?v=4)[Alex Ermashev](/maintainers/esase)[@esase](https://github.com/esase)

---

Top Contributors

[![esase](https://avatars.githubusercontent.com/u/3234529?v=4)](https://github.com/esase "esase (12 commits)")

---

Tags

esaseframeworklightweightmicroservicesmvcroutingtinyframeworkframeworkroutingmvclightweightmicroservicestinyframeworkesase

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/esase-tiny-router/health.svg)

```
[![Health](https://phpackages.com/badges/esase-tiny-router/health.svg)](https://phpackages.com/packages/esase-tiny-router)
```

###  Alternatives

[mirekmarek/php-jet

PHP Jet is modern, powerful, real-life proven, really fast and secure, small and light-weight framework for PHP8 with great clean and flexible modular architecture containing awesome developing tools. No magic, just clean software engineering.

241.3k](/packages/mirekmarek-php-jet)

PHPackages © 2026

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