PHPackages                             starbug/routing - 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. starbug/routing

ActiveLibrary[Framework](/categories/framework)

starbug/routing
===============

A router designed for Starbug PHP framework.

v1.0.0(6mo ago)02.0k1GPL-3.0-or-laterPHP

Since May 13Pushed 6mo ago1 watchersCompare

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

READMEChangelogDependencies (5)Versions (5)Used By (1)

Routing Library
===============

[](#routing-library)

A routing library for the Starbug PHP framework.

Setup
=====

[](#setup)

First implement RouteProviderInterface to define routes.

```
namespace MyApp;

use Starbug\Routing\RouteProviderInterface;
use Starbug\Routing\Controller;
use Starbug\Routing\Controller\ViewController;

class RouteProvider implements RouteProviderInterface {
  /**
   * @param Route $routes This is the root path "/"
   */
  public function configure(Route $routes) {
    // Configure the root path
    $routes->setController(ViewController::class);
    $routes->setOption("view", "home.html");

    // This Route is added from the root so the full path is "/" + "home" = "/home"
    $home = $routes->addRoute("home", ViewController::class, [
      "view" => "home.html"
    ]);
    $routes->addRoute("missing", [Controller::class, "missing"]);
    $routes->addRoute("forbidden", [Controller::class, "forbidden"]);

    // Adding from the above "/home" Route, the full path will  be "/home/test"
    $home->addRoute("/test", ViewController::class, [
      "view" => "test.html"
    ]);
  }
}
```

Next create a Route Configuration with one or more provider instances.

```
namespace MyApp;

use Starbug\Routing\Configuration;

$config = new Configuration();
$provider = new RouteProvider();

$config->addProvider($provider);
```

Next use the Configuration object to create a RouteStorageInterface implementation. We will use the included FastRouteStorage.

```
namespace MyApp;

use Starbug\Routing\FastRouteStorage;

$dispatcher = FastRouteStorage::createDispatcher($config);
$storage = new FastRouteStorage($dispatcher, $access);
```

Now we can instantiate a Router.

```
namespace MyApp;

use Starbug\Routing\Router;

// Must be instance of Invoker\InvokerInterface
$invoker;

$router = new Router($invoker);
$router->addStorage($storage);
```

Usage
=====

[](#usage)

You can use the router directly or use the provided PSR-15 middlewares (RoutingMiddleware and ControllerMiddleware).

```
// Pass in a PSR-7 ServerRequestInterface instance and get back the route.
$route = $this->router->route($request);
```

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance66

Regular maintenance activity

Popularity19

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity47

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

Every ~298 days

Total

4

Last Release

207d ago

Major Versions

v0.9.2 → v1.0.02025-10-23

### Community

Maintainers

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

---

Top Contributors

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

---

Tags

routerrouting

### Embed Badge

![Health badge](/badges/starbug-routing/health.svg)

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

###  Alternatives

[klein/klein

A lightning fast router for PHP

2.7k1.1M31](/packages/klein-klein)[pecee/simple-router

Simple, fast PHP router that is easy to get integrated and in almost any project. Heavily inspired by the Laravel router.

696214.6k17](/packages/pecee-simple-router)[vlucas/bulletphp

A heierarchical resource-oriented micro-framework built on nested closures instead of route-based callbacks

41949.9k1](/packages/vlucas-bulletphp)[izniburak/router

simple router class for php

23522.6k7](/packages/izniburak-router)[vectorface/snappy-router

A quick and snappy routing framework.

4614.7k](/packages/vectorface-snappy-router)[thewunder/croute

Convention based routing for PHP

1317.4k](/packages/thewunder-croute)

PHPackages © 2026

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