PHPackages                             darling/roady-routing-utilities - 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. darling/roady-routing-utilities

ActiveProject

darling/roady-routing-utilities
===============================

Routing utilities for the Roady php framework.

v1.0.6(2y ago)1166↓100%[1 issues](https://github.com/sevidmusic/RoadyRoutingUtilities/issues)MITPHPPHP ^8.1

Since Feb 8Pushed 2y ago1 watchersCompare

[ Source](https://github.com/sevidmusic/RoadyRoutingUtilities)[ Packagist](https://packagist.org/packages/darling/roady-routing-utilities)[ RSS](/packages/darling-roady-routing-utilities/feed)WikiDiscussions main Synced today

READMEChangelog (7)Dependencies (9)Versions (9)Used By (0)

RoadyRoutingUtilities
=====================

[](#roadyroutingutilities)

The RoadyRoutingUtilities library provides the classes responsible for handling routing for the [Roady](https://github.com/sevidmusic/roady)`php` framework.

Though it is designed for use with the [Roady](https://github.com/sevidmusic/roady)`php` framework, this library can be used on it's own.

Installation
============

[](#installation)

```
composer require darling/roady-routing-utilities
```

Classes
=======

[](#classes)

### `Darling\RoadyRoutingUtilities\classes\requests\Request`

[](#darlingroadyroutingutilitiesclassesrequestsrequest)

A Request represents a request to a server.

A Request has a Name, and a Url.

A Request's Name will either be based on the value of the `request`query parameter that is assigned to the Request's Url, the value of `$_POST['request']`, or the value of `$_GET['request']`.

If the Url is not assigned a query parameter named `request`, and nither `$_POST['request']` or `$_GET['request']` is set, then the Request's Name will be `homepage`.

Note: The Url's request query parameter will always be preferred if it is set, then `$_POST['request']`, then `$_GET['request']`.

Examples:

To define a Request that represents the current request to a server instantiate a new Request without any arguments:

```
$currentRequest = new \Darling\RoadyRoutingUtilities\classes\requests\Request();
```

To define a Request that represents a specific request to a server an opitional url `string` such as `http://example.com:8080?query#fragment`may be passed to the new Request's `__construct` method.

For example:

```
$specificRequest = new \Darling\RoadyRoutingUtilities\classes\requests\Request(
    'http://www.example.com:8080/path?query#fragment'
);
```

### `Darling\RoadyRoutingUtilities\classes\responses\Response`

[](#darlingroadyroutingutilitiesclassesresponsesresponse)

A Response represents the relationship between a Request and collection of Routes that should be served in response to that Request.

Examples:

To define a Response for a specific Request to a server:

```
$specificRequest = new \Darling\RoadyRoutingUtilities\classes\requests\Request(
    'http://www.example.com:8080/path?query#fragment'
);

$routeCollection = new \Darling\RoadyRoutes\classes\collections\RouteCollection(
    new \Darling\RoadyRoutes\classes\routes\Route(
        moduleName: new \Darling\PHPTextTypes\classes\strings\Name(
            new \Darling\PHPTextTypes\classes\strings\Text('hello-world'),
        ),
        // Names of the Requests this Route should be served in response to.
        nameCollection: new \Darling\PHPTextTypes\classes\collections\NameCollection(
            new \Darling\PHPTextTypes\classes\strings\Name(
                new \Darling\PHPTextTypes\classes\strings\Text('homepage'),
            ),
        ),
        // Named positions where this Routes output should be rendered by Roady's UI.
        namedPositionCollection: new \Darling\RoadyRoutes\classes\collections\NamedPositionCollection(
            new \Darling\RoadyRoutes\classes\identifiers\NamedPosition(
                new \Darling\RoadyRoutes\classes\identifiers\PositionName(
                    new \Darling\PHPTextTypes\classes\strings\Name(
                        new \Darling\PHPTextTypes\classes\strings\Text('TargetPositionName'),
                    )
                ),
                new \Darling\RoadyRoutes\classes\settings\Position(0),
            ),
        ),
        // RelativePath to this Routes output file.
        relativePath: new \Darling\RoadyRoutes\classes\paths\RelativePath(
            new \Darling\PHPTextTypes\classes\collections\SafeTextCollection(
                new SafeText(new \Darling\PHPTextTypes\classes\strings\Text('output')),
                new SafeText(new \Darling\PHPTextTypes\classes\strings\Text('homepage.html')),
            )
        ),
    ),
);

$response = new Darling\RoadyRoutingUtilities\classes\responses\Response(
    $specificRequest, $routeCollection
);
```

### `Darling\RoadyRoutingUtilities\classes\routers\Router`

[](#darlingroadyroutingutilitiesclassesroutersrouter)

A Router can accept a Request and return an appropriate Response for that Request.

Examples:

```
$specificRequest = new \Darling\RoadyRoutingUtilities\classes\requests\Request(
    'http://www.example.com:8080/path?query#fragment'
);

$router = new \Darling\RoadyRoutingUtilities\classes\routers\Router(
    new \Darling\RoadyModuleUtilities\classes\directory\listings\ListingOfDirectoryOfRoadyModules(
        new \Darling\RoadyModuleUtilities\classes\paths\PathToDirectoryOfRoadyModules(
            new \Darling\PHPFileSystemPaths\classes\paths\PathToExistingDirectory(
                new \Darling\PHPTextTypes\classes\collections\SafeTextCollection(
                    new \Darling\PHPTextTypes\classes\strings\SafeText(
                        new \Darling\PHPTextTypes\classes\strings\Text('path'),
                    ),
                    new \Darling\PHPTextTypes\classes\strings\SafeText(
                        new \Darling\PHPTextTypes\classes\strings\Text('to'),
                    ),
                    new \Darling\PHPTextTypes\classes\strings\SafeText(
                        new \Darling\PHPTextTypes\classes\strings\Text('directory'),
                    ),
                    new \Darling\PHPTextTypes\classes\strings\SafeText(
                        new \Darling\PHPTextTypes\classes\strings\Text('of'),
                    ),
                    new \Darling\PHPTextTypes\classes\strings\SafeText(
                        new \Darling\PHPTextTypes\classes\strings\Text('roady'),
                    ),
                    new \Darling\PHPTextTypes\classes\strings\SafeText(
                        new \Darling\PHPTextTypes\classes\strings\Text('modules'),
                    ),
                )
            ),
        ),
    ),
    new \Darling\RoadyModuleUtilities\classes\determinators\ModuleCSSRouteDeterminator(),
    new \Darling\RoadyModuleUtilities\classes\determinators\ModuleJSRouteDeterminator(),
    new \Darling\RoadyModuleUtilities\classes\determinators\ModuleOutputRouteDeterminator(),
    new \Darling\RoadyModuleUtilities\classes\determinators\RoadyModuleFileSystemPathDeterminator(),
    new \Darling\RoadyModuleUtilities\classes\configuration\ModuleRoutesJsonConfigurationReader(),
);

$response = $router->handleRequest($specificRequest);
```

As a final example, the following is a snippet from [Roady's](https://github.com/sevidmusic/roady)`index.php` demonstrating how a Request, Response, and Router are used in practice:

```
$currentRequest = new Request();
$roadyModuleFileSystemPathDeterminator =
    new RoadyModuleFileSystemPathDeterminator();

$router = new Router(
    new ListingOfDirectoryOfRoadyModules(
        RoadyAPI::pathToDirectoryOfRoadyModules()
    ),
    new ModuleCSSRouteDeterminator(),
    new ModuleJSRouteDeterminator(),
    new ModuleOutputRouteDeterminator(),
    $roadyModuleFileSystemPathDeterminator,
    new ModuleRoutesJsonConfigurationReader(),
);

$response = $router->handleRequest($currentRequest);

$roadyUI = new RoadyUI(
    RoadyAPI::pathToDirectoryOfRoadyModules(),
    new RouteCollectionSorter(),
    $roadyModuleFileSystemPathDeterminator,
);

echo $roadyUI->render($response);
```

###  Health Score

22

—

LowBetter than 24% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity55

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

Total

7

Last Release

757d ago

### Community

Maintainers

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

---

Top Contributors

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

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/darling-roady-routing-utilities/health.svg)

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

PHPackages © 2026

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