PHPackages                             petrorud/mererouter - 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. petrorud/mererouter

ActiveLibrary[Framework](/categories/framework)

petrorud/mererouter
===================

Lightweight PHP router

v2.0.7(2y ago)0111MITPHPPHP &gt;=7.0

Since Oct 14Pushed 2y agoCompare

[ Source](https://github.com/RudovskiyPO/mererouter)[ Packagist](https://packagist.org/packages/petrorud/mererouter)[ RSS](/packages/petrorud-mererouter/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (10)DependenciesVersions (13)Used By (0)

Mere Router
===========

[](#mere-router)

Install with Composer
---------------------

[](#install-with-composer)

Just run:

```
composer require petrorud/mererouter

```

Or add to your composer.json:

```
"require": {
    "petrorud/mererouter": "^2.0"
}
```

Simple sample
-------------

[](#simple-sample)

```
require $pathToComposerAutoload; // require 'vendor/autoload.php';
use petrorud\Router as Router;

// Configs that you wants to transfer to controllers (closures)
Router::setConfigs([
    'config-key-1' => 'config-value-1',
]);

// Register routes
Router::registerRoute('^/landing-page-1/$', function () {
    echo "Landing Page №1";

});
Router::registerRoute('^/page-{PageNumber}/$', function ($params) {
    $attrs = $params['attrs']; // This way you can get access to attributes such as GET params and values parsed from URI path
    echo "Page №{$attrs['PageNumber']}";

});

// Also you can register routes as tree if you want to see routes structure more clearly
Router::setRoutesTree([
    '^' => [
        '/$' => [
            ':' => [
                Router::action(function ($params) {
                    echo "Home Page";
                    $configs = $params['configs']; // This way you can get access to configs you passed to Router::setConfigs method
                    print_r($configs);

                }),
            ],
        ],
        '/entity-page' => [
            '/$' => [
                ':' => [
                    Router::action(function ($params) {
                        echo "Entities index page";

                    }),
                ],
            ],
            '/{Id}/$' => [
                ':' => [
                    Router::action(function ($params) {
                        echo "One entity page";
                        $attrs = $params['attrs']; // This way you can get access to attributes such as GET params and values parsed from URI path
                        print_r($attrs);

                    }),
                ],
            ],
        ],
        '/api' => [
            '/entities' => [
                '/$' => [
                    ':' => [
                        Router::action(function ($params) {
                            $data = []; // Requested entities data
                            header('Content-Type: application/json');
                            echo json_encode($data);

                        }),
                        Router::action(function ($params) {
                            $newEntityData = json_decode($_POST['new-entity-data'] ?? [], true);
                            // Create new entity

                        }, 'POST'),
                    ],
                ],
                '/entity' => [
                    '/{Id}' => [
                        '/$' => [
                            ':' => [
                                Router::action(function ($params) {
                                    $entityId = $params['attrs']['Id'];
                                    $data = []; // Requested entity[id=$entityId] data
                                    header('Content-Type: application/json');
                                    echo json_encode($data);

                                }),
                                Router::action(function ($params) {
                                    $entityId = $params['attrs']['Id'];
                                    $entityData = json_decode($_POST['entity-data'] ?? [], true);
                                    // Update existing entity[id=$entityId]

                                }, ['POST', 'PUT']),
                                Router::action(function ($params) {
                                    $entityId = $params['attrs']['Id'];
                                    // Delete entity[id=$entityId]

                                }, 'DELETE'),
                            ],
                        ],
                    ],
                ],
            ],
        ],
    ],
]);

// You can specify functions you need to call before routing
Router::runMiddlewares([
    function($params) {
        echo "Middleware 1 ";
    }
]);

// You can also set some options
Router::run([
    // specify action for "Not Found 404" case ('not_found')
    'not_found' => function($params) {
        http_response_code(404);
    },
    // manage routes sorting by your own ('sort')
    'sort' => function ($a, $b) {
        return strlen($b['regex'])  strlen($a['regex']);
    },
]);
```

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity60

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

Recently: every ~264 days

Total

12

Last Release

1070d ago

Major Versions

v1.2.2 → v2.0.02020-01-21

PHP version history (2 changes)v1.1.0PHP 7.\*

v2.0.7PHP &gt;=7.0

### Community

Maintainers

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

---

Top Contributors

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

---

Tags

routermererouter

### Embed Badge

![Health badge](/badges/petrorud-mererouter/health.svg)

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

###  Alternatives

[slim/slim

Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs

12.2k49.9M1.3k](/packages/slim-slim)[klein/klein

A lightning fast router for PHP

2.7k1.1M31](/packages/klein-klein)[slim/slim-skeleton

A Slim Framework skeleton application for rapid development

1.6k458.7k6](/packages/slim-slim-skeleton)[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)[rareloop/router

A powerful PHP Router for PSR7 messages inspired by the Laravel API

92178.9k4](/packages/rareloop-router)[yiisoft/router

Yii router

62321.8k21](/packages/yiisoft-router)

PHPackages © 2026

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