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
=====================

Secure lightweight PHP router with RBAC, CSRF and HTTP error handling

1.0.3(1mo ago)116MITPHP

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 1mo ago

READMEChangelogDependencies (5)Versions (4)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

38

—

LowBetter than 85% of packages

Maintenance92

Actively maintained with recent releases

Popularity10

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity36

Early-stage or recently created project

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

Total

3

Last Release

38d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b1998fae7d200cd1bcb95644923c0cd312c5f8898f93264e8e00ba357d6c428b?d=identicon)[SethRensei](/maintainers/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/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[phpro/http-tools

HTTP tools for developing more consistent HTTP implementations.

28137.8k](/packages/phpro-http-tools)[shopify/shopify-api

Shopify API Library for PHP

4634.8M16](/packages/shopify-shopify-api)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.2M386](/packages/shopware-core)[spiral/roadrunner-http

RoadRunner: HTTP and PSR-7 worker

779.2M48](/packages/spiral-roadrunner-http)[laudis/neo4j-php-client

Neo4j-PHP-Client is the most advanced PHP Client for Neo4j

184616.9k31](/packages/laudis-neo4j-php-client)

PHPackages © 2026

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