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

ActiveLibrary[Framework](/categories/framework)

niirrty/niirrty.routing
=======================

A PHP routing library.

0.6.2(2y ago)033MITPHPPHP &gt;=8.1

Since Nov 4Pushed 2y agoCompare

[ Source](https://github.com/Niirrty/Niirrty.Routing)[ Packagist](https://packagist.org/packages/niirrty/niirrty.routing)[ RSS](/packages/niirrty-niirrtyrouting/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (6)DependenciesVersions (7)Used By (0)

Niirrty.Routing
===============

[](#niirrtyrouting)

The routing library

Installation
------------

[](#installation)

inside the `composer.json`:

```
{
   "require": {
      "php": ">=8.1",
      "niirrty/niirrty.routing": "~0.6"
   }
}
```

Usage
-----

[](#usage)

Routing is really simple:

First create a `.htaccess` file inside the `DOCUMENT_ROOT`.

```
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [QSA,L]

```

This means: All requests to a not existing file or directory will be redirected to `index.php`The called, not existing URL path, is passed to `$_SERVER[ 'REQUEST_URI' ]`.

If you want to use this package inside you're application include the depending composer autoload.php

```
use \Niirrty\Routing\UrlPathLocator\RequestUri as RequestUriLocator;
use \Niirrty\Routing\UrlPathLocator\ILocator;

// Get the current called not existing URL path by $_SERVER[ 'REQUEST_URI' ]
$urlPathLocator = new RequestUriLocator();

// Init the router and chain all required stuff
$router = \Niirrty\Routing\Router::CreateInstance()

    // Handling URL paths, not declared by a route
    ->setFallBackHandler(
        function( ILocator $locator ) use( $twig )
        {
            // TODO: add code for handling URL paths, not declared by a route
            echo 'Invalid request!';
            exit;
        } )

    // Redirect all index calls to '/' (home call)
    ->addMultiPathStaticRedirection(
        [ '/app.php', '/index.html', '/start.php', '/start.html', '/home.php', '/start.html' ],
        '' )

    // Home call
    ->addSimpleRoute(
        '/',
        function( ILocator $locator )
        {
            // TODO: show the home
        } )

    // handling '/services/*' calls
    ->addRegexRoute(
        '~^/services/([A-Za-z0-9_.:-]+)/?$~',
        [
            function( $matches )
            {
                // TODO: $matches[ 1 ] defines the first part inside parenthesis, and so on
                echo '';
                print_r( $matches );
                exit;
            }
        ] )

    // add an simple route for showing the impressum
    ->addSimpleRoute( '/impressum', function( ILocator $locator )
      {
         // TODO: show the impressum
      } );

// Call the router with current locator => Done
$router->call( $urlPathLocator );
```

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity66

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

Every ~460 days

Recently: every ~552 days

Total

6

Last Release

810d ago

PHP version history (3 changes)0.1.0PHP &gt;=7.1

0.4.0PHP &gt;=8.0

0.5.0PHP &gt;=8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/56201fee0dd151f8d0ce7dfe228cc74aa1bae7949664bc8644cdb5620e329b88?d=identicon)[Niirrty](/maintainers/Niirrty)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/niirrty-niirrtyrouting/health.svg)

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

###  Alternatives

[laravel/telescope

An elegant debug assistant for the Laravel framework.

5.2k67.8M192](/packages/laravel-telescope)[spiral/roadrunner

RoadRunner: High-performance PHP application server and process manager written in Go and powered with plugins

8.4k12.2M84](/packages/spiral-roadrunner)[nolimits4web/swiper

Most modern mobile touch slider and framework with hardware accelerated transitions

41.8k177.2k1](/packages/nolimits4web-swiper)[laravel/dusk

Laravel Dusk provides simple end-to-end testing and browser automation.

1.9k36.7M259](/packages/laravel-dusk)[laravel/prompts

Add beautiful and user-friendly forms to your command-line applications.

708181.8M596](/packages/laravel-prompts)[cakephp/chronos

A simple API extension for DateTime.

1.4k47.7M121](/packages/cakephp-chronos)

PHPackages © 2026

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