PHPackages                             netrivet/wp-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. [Utility &amp; Helpers](/categories/utility)
4. /
5. netrivet/wp-router

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

netrivet/wp-router
==================

A simple router for WordPress plugins and themes

6.0.0(4y ago)188.3k1MITPHPPHP &gt;=5.3.0

Since Jun 14Pushed 4y ago3 watchersCompare

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

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

wp-router [![Build Status](https://camo.githubusercontent.com/8cd1c60e71bfe5f9e0088c05cd2bb9b91aaac93e717583dd4b3db99aa69e01ae/68747470733a2f2f7472617669732d63692e6f72672f646f776e73686966746f72672f77702d726f757465722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/downshiftorg/wp-router)
===========================================================================================================================================================================================================================================================================================================

[](#wp-router-)

A simple scoped router powered by query string parameters.

Though this has use outside of WordPress (for now), it is meant for use within the WordPress ecosystem as a means to add custom routes without specific page scripts.

usage
-----

[](#usage)

The router matches a get or post request to a responder. A responder is a function or an invokable class.

```
use DownShift\WordPress\Router;

$router = new Router('my_scope');

// matches ?my_scope=/myroute
$router->post('/myroute', function () {
  // do something here
});

// listen terminates via exit after route function executes
$router->listen();
```

You can also give a route definition an invokable class.

```
$router->post('/myroute', new InvokableClass());

// or a string if you prefer
$router->post('/myroute', 'DownShift\Responders\SomeClass');
```

service injection
-----------------

[](#service-injection)

Services in route functions are resolved using a PHP 5.3 friendly version of the [Illuminate Container](https://github.com/downshiftorg/container)

```
$container = new Container();
$container->bind('SomeInterface', 'SomeImplementation');
$router = new Router('my_scope');
$router->bind($container);

$router->get('/test', function (SomeInterface $service) {
  // do a thing with $service
});
```

If resolving a class, the constructor will have dependencies injected. Resolution of classes is only valid when using a string.

tests
-----

[](#tests)

Tests are written using [peridot](http://peridot-php.github.io/), and can be run like so:

```
vendor/bin/peridot

```

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity27

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 64.7% 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 ~485 days

Recently: every ~597 days

Total

6

Last Release

1565d ago

Major Versions

1.0.0 → 2.0.02015-07-22

2.0.0 → 3.0.02018-01-15

3.0.0 → 4.0.02020-05-12

4.0.0 → 5.0.02021-08-04

5.0.0 → 6.0.02022-02-03

### Community

Maintainers

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

---

Top Contributors

[![brianium](https://avatars.githubusercontent.com/u/636651?v=4)](https://github.com/brianium "brianium (11 commits)")[![mdietsche](https://avatars.githubusercontent.com/u/11544705?v=4)](https://github.com/mdietsche "mdietsche (4 commits)")[![jaredh159](https://avatars.githubusercontent.com/u/7050938?v=4)](https://github.com/jaredh159 "jaredh159 (2 commits)")

### Embed Badge

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

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

###  Alternatives

[ashallendesign/short-url

A Laravel package for creating shortened URLs for your web apps.

1.4k1.9M4](/packages/ashallendesign-short-url)[illuminate/events

The Illuminate Events package.

13454.3M1.8k](/packages/illuminate-events)[psalm/plugin-laravel

Psalm plugin for Laravel

3274.9M308](/packages/psalm-plugin-laravel)[illuminate/broadcasting

The Illuminate Broadcasting package.

7126.5M178](/packages/illuminate-broadcasting)[chelout/laravel-relationship-events

Missing relationship events for Laravel

5252.3M17](/packages/chelout-laravel-relationship-events)[flarum/core

Delightfully simple forum software.

211.3M1.9k](/packages/flarum-core)

PHPackages © 2026

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