PHPackages                             sw04/route-me - 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. sw04/route-me

ActiveLibrary

sw04/route-me
=============

router with routes groups &amp; before-after actions

v1(11y ago)145proprietaryPHP

Since Nov 18Pushed 11y ago1 watchersCompare

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

READMEChangelog (1)DependenciesVersions (2)Used By (0)

Light php routing library support:

- routes
- optional &amp; requirements params
- group routes
- actions before &amp; after route
- define controller, method &amp; params

Composer install:

```
composer require sw04/route-me
```

Initialize:

```
$router = \Router\Singleton::getInstance();
```

Simple route for GET and POST methods with required integer and string param:

```
$router->get('/show/{[0-9]+}'); //sample: GET /show/1024
$router->post('/show/{[a-z]+}'); //sample: POST /show/sample
```

Simple route with not required param:

```
$router->get('/show/!{[0-9]+}'); //sample: GET /show or /show/1024
```

Simple route with defined controller &amp; method:

```
$router
    ->setController('index')
    ->setMethod('index')
    ->get('/')
    ->clear();
```

Simple group routes(set prefix "/admin") and add actions before route match:

```
function isAuth() {
    //check auth & return true or false
    return true;
}
function isAdmin() {
    //check role is admin or not & return true or false
    return false;
}
$router
    ->setPrefix('/admin')
    ->setAction('before', 'isAuth')
    ->setAction('before', 'isAdmin')
    ->get('/dashboard')
    ->clear();
```

Simple set prefix(namespace) for all classes:

```
$router->setNamespace('\\Application\\Project\\');
```

Match routes:

```
try {
    $result = $router->match(getenv('REQUEST_URI'));
    if (is_array($result)) { //convert to json if is array
        $result = json_encode($result);
    }
    echo $result; //echo result of match
} catch(\Router\RouterException $e) {
    echo $e->getMessage().' code is '.$e->getCode();
}
```

All routes set next requirements for routes:

```
method - GET, POST, ANY
prefix - for route url
url - to route
actions - before & after route match
defineClass - define controller
defineMethod - define method
defineParams - define params

```

For clear all this requirements use:

```
$routes->clear();
```

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity63

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

Unknown

Total

1

Last Release

4197d ago

### Community

Maintainers

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

---

Top Contributors

[![sw04](https://avatars.githubusercontent.com/u/1109329?v=4)](https://github.com/sw04 "sw04 (21 commits)")

### Embed Badge

![Health badge](/badges/sw04-route-me/health.svg)

```
[![Health](https://phpackages.com/badges/sw04-route-me/health.svg)](https://phpackages.com/packages/sw04-route-me)
```

PHPackages © 2026

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