PHPackages                             romaluck/php-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. [Framework](/categories/framework)
4. /
5. romaluck/php-router

ActiveLibrary[Framework](/categories/framework)

romaluck/php-router
===================

A simple router for PHP

v1.0.1(1y ago)01MITPHPPHP ^8.2

Since May 9Pushed 1y ago1 watchersCompare

[ Source](https://github.com/RomaLuck/SimplePhpRouter)[ Packagist](https://packagist.org/packages/romaluck/php-router)[ RSS](/packages/romaluck-php-router/feed)WikiDiscussions main Synced today

READMEChangelog (2)Dependencies (1)Versions (3)Used By (0)

Table of contents
-----------------

[](#table-of-contents)

- [General info](#general-info)
- [Installation](#installation)
- [Usage](#usage)
- [Routing](#routing)
- [Controller](#controller)
- [Middleware](#middleware)

General info
------------

[](#general-info)

This is a simple router for PHP

Requirements
------------

[](#requirements)

- PHP &gt;= 8.2
- Symfony/http-foundation &gt;= 7.2

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

[](#installation)

```
composer require romaluck/php-router

```

Usage
-----

[](#usage)

```
// Require composer autoloader
require __DIR__ . '/vendor/autoload.php';

$request = Request::createFromGlobals();

// Create Router instance
$router = new Romaluck\PhpRouter\Router($request);

// Define routes
// ...

// Run it!
$router->send();
```

Routing
-------

[](#routing)

```
$router->match(
    Route::get('/', IndexController::class)->addMiddleware(new AuthMiddleware()),
    Route::post('/upload', UploadImageController::class),
)
```

Controller
----------

[](#controller)

```
//Controller should implement ControllerInterface
class IndexController implements ControllerInterface
{
    public function __invoke(Request $request): Response
```

Middleware
----------

[](#middleware)

```
use Romaluck\PhpRouter\Middleware\MiddlewareInterface;
use Romaluck\PhpRouter\Middleware\RequestHandlerInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;

//Middleware should implement MiddlewareInterface
class AuthMiddleware implements MiddlewareInterface
{

    public function process(Request $request, RequestHandlerInterface $handler): Response
```

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance46

Moderate activity, may be stable

Popularity1

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity51

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

Total

2

Last Release

419d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/99766226?v=4)[Roman](/maintainers/RomaLuck)[@RomaLuck](https://github.com/RomaLuck)

---

Top Contributors

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

### Embed Badge

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

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

###  Alternatives

[laravel/framework

The Laravel Framework.

34.8k543.8M20.1k](/packages/laravel-framework)[symfony/framework-bundle

Provides a tight integration between Symfony components and the Symfony full-stack framework

3.6k251.7M11.6k](/packages/symfony-framework-bundle)[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k17.9M386](/packages/easycorp-easyadmin-bundle)[pimcore/pimcore

Content &amp; Product Management Framework (CMS/PIM/E-Commerce)

3.8k3.8M508](/packages/pimcore-pimcore)[drupal/core

Drupal is an open source content management platform powering millions of websites and applications.

21866.0M1.7k](/packages/drupal-core)[typo3/cms

TYPO3 CMS is a free open source Content Management Framework initially created by Kasper Skaarhoj and licensed under GNU/GPL.

1.2k1.9M122](/packages/typo3-cms)

PHPackages © 2026

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