PHPackages                             sethrensei/ren-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. [HTTP &amp; Networking](/categories/http)
4. /
5. sethrensei/ren-router

ActiveLibrary[HTTP &amp; Networking](/categories/http)

sethrensei/ren-router
=====================

PHP micro-router with RBAC, Twig support, URL extension spoofing and centralized HTTP exception handling

1.1.0(1w ago)15MITPHP

Since Jan 13Pushed 1mo agoCompare

[ Source](https://github.com/SethRensei/RenRouter)[ Packagist](https://packagist.org/packages/sethrensei/ren-router)[ RSS](/packages/sethrensei-ren-router/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (17)Versions (11)Used By (0)

RenRouter
=========

[](#renrouter)

RenRouter is a **modern, lightweight and secure PHP micro‑router**, designed for projects without a full framework or as the core of a custom micro‑framework.

It provides clean HTTP orchestration (routing, dispatching, views, errors), declarative security (authentication and roles), and a proper HTTP request abstraction.

---

✨ Key Features
--------------

[](#-key-features)

- HTTP routing powered by **AltoRouter**
- Fluent and readable route definitions
- Route protection with **authentication and roles**
- Centralized **HTTP exception handling** (401, 403, 404, 500)
- Dedicated error pages
- AJAX / Turbo / XHR support
- HTTP request abstraction (`Request`)
- Secure file uploads (`UploadedFile`)
- Optional PSR‑3 logger support

---

🧱 Architecture
--------------

[](#-architecture)

```
RenRouter/
├── src/
│   ├── Router.php
│   ├── Security/
│   │   └── Auth.php
│   ├── Http/
│   │   ├── Request.php
│   │   ├── UploadedFile.php
│   │   └── Exception/
│   │       ├── HttpException.php
│   │       ├── UnauthorizedHttpException.php
│   │       ├── ForbiddenHttpException.php
│   │       └── NotFoundHttpException.php
├── views/
│   ├── base.php
│   └── errors/
│       ├── 401.php
│       ├── 403.php
│       ├── 404.php
│       └── 500.php
└── public/
    └── index.php

```

---

🚀 Usage Example
---------------

[](#-usage-example)

```
$router->route(
    '/user/[i:id]',
    [$userController, 'show'],
    'GET',
    'user.show',
    [
        'auth'  => true,
        'roles' => ['admin', 'editor']
    ]
);
```

- The user **must be authenticated**
- The user must have **at least one of the required roles**

---

🔐 Security &amp; Roles
----------------------

[](#-security--roles)

RenRouter follows a **declarative security model**:

- No authentication logic inside controllers
- Security rules are defined **at route level**
- A user may have **one or multiple roles**

```
['auth' => true, 'roles' => ['user']]
```

Automatically thrown exceptions:

SituationExceptionHTTP CodeNot authenticatedUnauthorizedHttpException401Invalid roleForbiddenHttpException403Route not foundNotFoundHttpException404---

❗ Error Handling
----------------

[](#-error-handling)

HTTP errors are centrally handled by the router and rendered using dedicated views:

```
views/errors/403.php
views/errors/404.php

```

The exception message is available in the view through `$errorMessage`.

---

📦 Requirements
--------------

[](#-requirements)

- PHP ≥ 8.1
- `fileinfo` extension enabled
- Composer

---

🎯 Philosophy
------------

[](#-philosophy)

RenRouter focuses on:

- **clarity over magic**
- **security by default**
- a **solid and extensible core**

It is not a framework, but a **reliable foundation** to build one.

---

📄 License
---------

[](#-license)

MIT — free to use and modify.

###  Health Score

39

—

LowBetter than 84% of packages

Maintenance93

Actively maintained with recent releases

Popularity7

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity41

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

Recently: every ~2 days

Total

10

Last Release

12d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/130877906?v=4)[Seth Sita](/maintainers/SethRensei)[@SethRensei](https://github.com/SethRensei)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/sethrensei-ren-router/health.svg)

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

###  Alternatives

[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

585.6M576](/packages/shopware-core)[shopware/platform

The Shopware e-commerce core

3.4k1.5M3](/packages/shopware-platform)[symfony/symfony

The Symfony PHP framework

31.4k87.2M2.2k](/packages/symfony-symfony)[guzzlehttp/psr7

PSR-7 message implementation that also provides common utility methods

8.0k1.1B4.0k](/packages/guzzlehttp-psr7)[tempest/framework

The PHP framework that gets out of your way.

2.2k34.4k15](/packages/tempest-framework)[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.7k38.9k](/packages/matomo-matomo)

PHPackages © 2026

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