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

AbandonedArchivedLibrary

xoket/router
============

Simple PCRE based routing engine.

1.0.0(14y ago)5262MITPHPPHP &gt;=5.3.0

Since Apr 21Pushed 14y ago1 watchersCompare

[ Source](https://github.com/jmhobbs/xoket-router)[ Packagist](https://packagist.org/packages/xoket/router)[ Docs](https://github.com/jmhobbs/xoket-router)[ RSS](/packages/xoket-router/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

What is this?
=============

[](#what-is-this)

It's a [PCRE](http://php.net/PCRE) based routing engine for PHP.

Where did it come from?
=======================

[](#where-did-it-come-from)

I wrote it from scratch as an exercise after dinner. It was fun.

How does it work?
=================

[](#how-does-it-work)

You specify routes, which are strings like so:

```
photos/:id(/:action)

```

The :id and :action are named parameters, and you can do a couple things with them.

You can specify constraints for what they will match:

```
xoket\Route::add( 'photos/:id(/:action)' )
  ->constraints( array( 'id' => '[0-9]+' ) );

```

and you can specify defaults:

```
xoket\Route::add( 'photos/:id(/:action)' )
  ->defaults( array( 'controller' => 'photo', 'action' => 'view' ) );

```

Now that you have routes, you can match on them:

```
xoket\Route::match( 'photos/5/delete' );

```

Route::match will either return false if no match is found, or an array of parameters, like so:

```
array(
  'directory'  => '',
  'controller' => 'photo',
  'action'     => 'delete',
  'id'         => '5',
)

```

The use of which is only limited by your imagination.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 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

Unknown

Total

1

Last Release

5138d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/275ea2ce829db1f6a6c00f2a23adc184701b39d0db817e396b32770431ec5e3c?d=identicon)[jmhobbs](/maintainers/jmhobbs)

---

Top Contributors

[![jmhobbs](https://avatars.githubusercontent.com/u/115059?v=4)](https://github.com/jmhobbs "jmhobbs (3 commits)")

---

Tags

routerrouting

### Embed Badge

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

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

###  Alternatives

[symfony/routing

Maps an HTTP request to a set of configuration variables

7.6k789.4M1.8k](/packages/symfony-routing)[nikic/fast-route

Fast request router for PHP

5.3k92.4M668](/packages/nikic-fast-route)[klein/klein

A lightning fast router for PHP

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

A lightning fast router for PHP

1.3k3.4M68](/packages/altorouter-altorouter)[bramus/router

A lightweight and simple object oriented PHP Router

1.1k458.8k49](/packages/bramus-router)[aura/router

Powerful, flexible web routing for PSR-7 requests.

5231.5M67](/packages/aura-router)

PHPackages © 2026

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