PHPackages                             perritu/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. perritu/router

ActiveLibrary[Framework](/categories/framework)

perritu/router
==============

Simple -yet powerfull- PHP Router

v2.0.4(5mo ago)01441UnlicensePHPPHP &gt;=8.1

Since Jan 11Pushed 5mo ago1 watchersCompare

[ Source](https://github.com/Perritu/Router)[ Packagist](https://packagist.org/packages/perritu/router)[ RSS](/packages/perritu-router/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependenciesVersions (9)Used By (0)

Perritu/Router
==============

[](#perriturouter)

A lightweight, simple, yet blazing fast PHP router.

[![Packagist Version](https://camo.githubusercontent.com/c17d04431c9603db0afcf71242a2059070ac2fa86f770e4d1da7c38d1c702520/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f706572726974752f726f757465723f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/c17d04431c9603db0afcf71242a2059070ac2fa86f770e4d1da7c38d1c702520/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f706572726974752f726f757465723f7374796c653d666c61742d737175617265)[![Packagist PHP Version](https://camo.githubusercontent.com/758f50c6d4c70dfd09c71067f67f67e293fa8ff8f69624ed6554ed374735c035/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f706572726974752f726f757465722f7068703f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/758f50c6d4c70dfd09c71067f67f67e293fa8ff8f69624ed6554ed374735c035/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f706572726974752f726f757465722f7068703f7374796c653d666c61742d737175617265)[![Packagist License](https://camo.githubusercontent.com/dbc12d0b8523fb55e1130ced7933873fc4bad1f761e9391e56d6a4de344bda6f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f706572726974752f726f757465723f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/dbc12d0b8523fb55e1130ced7933873fc4bad1f761e9391e56d6a4de344bda6f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f706572726974752f726f757465723f7374796c653d666c61742d737175617265)[![Codacy Badge](https://camo.githubusercontent.com/377c81f915daa6e3c99c2ce5ddf5393805d339289189fa33645ff8bea07ad4f6/68747470733a2f2f6170702e636f646163792e636f6d2f70726f6a6563742f62616467652f47726164652f6634323035396134646337353461666438663666663236636465643363353065)](https://app.codacy.com/gh/Perritu/Router/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)[![Ask DeepWiki](https://camo.githubusercontent.com/0f5ae213ac378635adeb5d7f13cef055ad2f7d9a47b36de7b1c67dbe09f609ca/68747470733a2f2f6465657077696b692e636f6d2f62616467652e737667)](https://deepwiki.com/Perritu/Router)

[![FOSSA Status](https://camo.githubusercontent.com/7b9e67bcf38ea76fd955aea9726bf437a5ace71e743f2a6bcb56227bf59478c1/68747470733a2f2f6170702e666f7373612e636f6d2f6170692f70726f6a656374732f6769742532426769746875622e636f6d25324650657272697475253246526f757465722e7376673f747970653d6c61726765)](https://app.fossa.com/projects/git%2Bgithub.com%2FPerritu%2FRouter?ref=badge_shield)

Features
--------

[](#features)

- Supports for `DELETE`, `GET`, `HEAD`, `OPTIONS`, `PATCH`, `POST` and `PUT`request methods.
- Routing shortcuts.
    - `Router::DELETE()`, `Router::GET()`, `Router::HEAD()`, etc.
- Static and dynamic PCRE-based routing.
- Custom `Path` and/or `HTTP-Method` call override.
- Use of `Path\to\public::method` callback.
- Subrouting / route prefixes.
- Subnamespace / namespace prefixes.
- Namespace mapping.

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

[](#requirements)

Perritu/Router can run just fine out-of-the-box (even without Composer).

The best way to implement is, of course, through composer, yet, it can be implemented without it.

All you need is PHP 8.1 or greater and any URL rewriting technique.

Installation.
-------------

[](#installation)

There are 2 ways of install.

- Using [composer](https://getcomposer.org/download/). (Recomended)
    - `composer require perritu/router`
- Direct download.
    - Downlad and place the `Router.php` file outside your publicly accessible directory, so any call must be performed throug your code flow.
    - Do a `require_once` import from your code flow.

    ```
    require_once(PROJECT_ROOT .'/include/perritu/router.php');
    ```

Usage
-----

[](#usage)

Once imported, do a `use` statement to start using the router, then, start with your routing definitions.

Bare example:

```
// Require statement
require_once('../vendor/autoload.php'); // Or router.php if not using composer.

use Perritu\Router\Router;

// Router definition
Router::GET('/', function() { echo 'Hello World!'; });
```

You can read the documentation in the [DOCS](DOCS/Class.md).

External links.
---------------

[](#external-links)

Codacy:

Packagist:

FOSSA: [https://app.fossa.com/projects/git%2Bgithub.com%2FPerritu%2FRouter?ref=badge\_large](https://app.fossa.com/projects/git%2Bgithub.com%2FPerritu%2FRouter?ref=badge_large)

###  Health Score

41

—

FairBetter than 87% of packages

Maintenance70

Regular maintenance activity

Popularity12

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 91.7% 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 ~180 days

Recently: every ~73 days

Total

7

Last Release

176d ago

Major Versions

v1.0.6-rc1 → v2.0.02025-03-13

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5545243?v=4)[Angel García](/maintainers/perritu)[@Perritu](https://github.com/Perritu)

---

Top Contributors

[![Perritu](https://avatars.githubusercontent.com/u/5545243?v=4)](https://github.com/Perritu "Perritu (22 commits)")[![fossabot](https://avatars.githubusercontent.com/u/29791463?v=4)](https://github.com/fossabot "fossabot (1 commits)")[![spaceagarcia](https://avatars.githubusercontent.com/u/234449809?v=4)](https://github.com/spaceagarcia "spaceagarcia (1 commits)")

---

Tags

router

### Embed Badge

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

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

###  Alternatives

[laravel/socialite

Laravel wrapper around OAuth 1 &amp; OAuth 2 libraries.

5.7k104.3M829](/packages/laravel-socialite)[laravel/dusk

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

1.9k38.6M289](/packages/laravel-dusk)[pinguo/php-msf

Pinguo Micro Service Framework For PHP

1.7k4.2k](/packages/pinguo-php-msf)[nineinchnick/edatatables

Grid widget for the Yii Framework, wrapper for the DataTables jQuery plugin

173.2k](/packages/nineinchnick-edatatables)[link-cloud/fast-hyperf

LinkCloud Fast Hyperf

241.2k1](/packages/link-cloud-fast-hyperf)

PHPackages © 2026

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