PHPackages                             wandu/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. [HTTP &amp; Networking](/categories/http)
4. /
5. wandu/router

AbandonedArchivedLibrary[HTTP &amp; Networking](/categories/http)

wandu/router
============

FastRoute with PSR-7 Wrapper Library.

v3.0.4(9y ago)42.9k2MITPHPPHP &gt;=5.6

Since May 19Pushed 8y ago1 watchersCompare

[ Source](https://github.com/Wandu/Router)[ Packagist](https://packagist.org/packages/wandu/router)[ RSS](/packages/wandu-router/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (2)Versions (39)Used By (0)

Wandu Router
============

[](#wandu-router)

[![Latest Stable Version](https://camo.githubusercontent.com/9b0bf34351792544a8b945db1ca3a6688d3d98d21e6f0b334eb158258c204f6b/68747470733a2f2f706f7365722e707567782e6f72672f77616e64752f726f757465722f762f737461626c652e737667)](https://packagist.org/packages/wandu/router)[![Latest Unstable Version](https://camo.githubusercontent.com/d80703a81fff3157d09355268a876f1bd2bdcaeeccc2727d2fbef9ccb3ec35dd/68747470733a2f2f706f7365722e707567782e6f72672f77616e64752f726f757465722f762f756e737461626c652e737667)](https://packagist.org/packages/wandu/router)[![Total Downloads](https://camo.githubusercontent.com/358394094222b640f001ef36cc980fb3d13b4cced077670faab50c81d500ffdb/68747470733a2f2f706f7365722e707567782e6f72672f77616e64752f726f757465722f646f776e6c6f6164732e737667)](https://packagist.org/packages/wandu/router)[![License](https://camo.githubusercontent.com/18bb6f7cf6276fb824bfb7dfb37641ff8c638296b0b908a8eaf1c632ef6d35a3/68747470733a2f2f706f7365722e707567782e6f72672f77616e64752f726f757465722f6c6963656e73652e737667)](https://packagist.org/packages/wandu/router)

FastRoute with PSR-7 Wrapper Library.

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

[](#installation)

```
composer require wandu/router
```

Basic Usage
-----------

[](#basic-usage)

```
$dispatcher = new \Wandu\Router\Dispatcher();
$routes = $dispatcher->createRouteCollection();

$routes->get('/', HomeController::class);
$routes->get('/users', UserController::class, 'index');
$routes->get('/users/:id', UserController::class, 'show');

$request = new ServerRequest('GET', '/'); // PSR7 ServerRequestInterface implementation
$response = $dispatcher->dispatch($routes, $request);

static::assertInstanceOf(ResponseInterface::class, $response);
static::assertEquals('index', $response->getBody()->__toString());

$request = new ServerRequest('GET', '/nothing'); // PSR7 ServerRequestInterface implementation
try {
    $dispatcher->dispatch($routes, $request);
} catch (RouteNotFoundException $e) {
    static::assertEquals('Route not found.', $e->getMessage());
}
```

```
class HomeController
{
    public static function index()
    {
        return new Response(200, new StringStream("index"));
    }
}
```

Pattern Routes
--------------

[](#pattern-routes)

```
$routes->get('/users/:id(\d+)?', UserController::class, 'show');
$routes->get('/users-:id', UserController::class, 'show');
```

```
class UserController
{
    public static function show(ServerRequestInterface $request)
    {
        return new Response(200, new StringStream("{$request->getAttribute('id')}"));
    }
}
```

You can use all patterns in [path-to-regexp](https://github.com/pillarjs/path-to-regexp).

Reference
---------

[](#reference)

- [nikic/FastRoute](https://github.com/nikic/FastRoute).

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community5

Small or concentrated contributor base

Maturity70

Established project with proven stability

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 ~24 days

Recently: every ~83 days

Total

37

Last Release

3161d ago

Major Versions

v0.7.0 → v3.0.0-alpha12016-04-20

3.0.x-dev → v4.0.0-beta12017-06-09

PHP version history (5 changes)v0.1.0PHP &gt;=5.5.0

v0.5.0PHP &gt;=5.6.0

v3.0.0-alpha1PHP &gt;=7.0.0

v3.0.0-beta4PHP &gt;=5.6

v4.0.0-beta1PHP &gt;=7.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/0b499bc2a487ec730542759876340fb439fe2474ea14f2105ca88f003717d495?d=identicon)[wan2land](/maintainers/wan2land)

---

Tags

middlewarerouterpsr7wandu

### Embed Badge

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

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

###  Alternatives

[league/route

Fast routing and dispatch component including PSR-15 middleware, built on top of FastRoute.

6633.1M115](/packages/league-route)[akrabat/ip-address-middleware

PSR-15 middleware that determines the client IP address and stores it as a ServerRequest attribute

1702.5M18](/packages/akrabat-ip-address-middleware)[middlewares/fast-route

Middleware to use FastRoute

96191.1k15](/packages/middlewares-fast-route)[akrabat/proxy-detection-middleware

PSR-7/PSR-15 Middleware that determines the scheme, host and port from the 'X-Forwarded-Proto', 'X-Forwarded-Host' and 'X-Forwarded-Port' headers and updates the Request's Uri object.

3190.4k1](/packages/akrabat-proxy-detection-middleware)[northwoods/router

Fast router for PSR-15 request handlers

161.4k](/packages/northwoods-router)[mtymek/blast-base-url

PSR-7 middleware and helpers for working with base URL.

1054.0k3](/packages/mtymek-blast-base-url)

PHPackages © 2026

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