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

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

faustvik/router
===============

Router php

v1.0(3y ago)012MITPHPPHP &gt;=8.1

Since May 6Pushed 7mo ago1 watchersCompare

[ Source](https://github.com/FaustVik/router)[ Packagist](https://packagist.org/packages/faustvik/router)[ RSS](/packages/faustvik-router/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)Dependencies (1)Versions (9)Used By (0)

Router
======

[](#router)

PHP Router

Example
-------

[](#example)

```
$collections = new RoutesCollection();

$fd = RouteAnonymousFunc::create('/anonym', static function (){
    echo "Anonymous Func";
}, ['POST']);

$collections->set(
    Route::create('/', TestController::class, 'actionIndex',[], ['POST'], '/aliasIndex'),
    $fd,
);

$config = new Config();
$config->setRunner(new Runner());

$router = new Router();
$router->setConfig($config);
$router->setCollection($collections);
$router->run();
```

### Route class

[](#route-class)

Route for class methods

- **Route** routing from uri, for example /test
- **Class** Controller class
- **Action** action (method) controller class
- **Arg** arguments for constructor controller class (optional)
- **Methods** list allowed http methods (POST, GET, PUT etc..)
- **Alias** alias for route (instead of **/test** **/testalias**) (optional)

Example:

```
Route::create('/', TestController::class, 'actionIndex',[], ['POST'], '/aliasIndex'),
```

### Route Anonymous func

[](#route-anonymous-func)

Route for anonymous functions

- **Route** routing from uri, for example /test
- **Func** anonymous function for route
- **Methods** list allowed http methods (POST, GET, PUT etc..)
- **Alias** alias for route (instead of **/test** **/testalias**) (optional)

Example:

```
RouteAnonymousFunc::create('/anonym', static function (){
    echo "Anonymous Func";
}, ['POST']);
```

### Router

[](#router-1)

Router class that parses the uri and run the action

### Runner

[](#runner)

the component is responsible for launching the action for the route Class for run action (controller class or anonymous function)

Runs a class method or an anonymous function

### Matcher

[](#matcher)

Compares the uri against the list of the route and tries to find a match or throws an exception

### CheckerHttpMethod

[](#checkerhttpmethod)

Сheck for permission for the found route allowed HTTP methods.

### Config

[](#config)

Config router

Methods:

- `setRunner()`
- `setCheckerHttpMethod()`
- `setMatcher()`

You can add (implement the interfaces) custom components for the router (by default, components from the directory `FaustVik\Router\Router\Component` are used):

and set to Config: Example:

```
$config = new Config();
$config->setRunner(new RunnerSmp());

$router = new Router();
$router->setConfig($config);
```

License
-------

[](#license)

MIT

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance45

Moderate activity, may be stable

Popularity5

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity62

Established project with proven stability

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

Recently: every ~310 days

Total

7

Last Release

221d ago

Major Versions

v0.3 → v1.02022-08-09

v1.0 → 2.0.0-beta.12025-10-08

### Community

Maintainers

![](https://www.gravatar.com/avatar/018ded1d1207643dd5e7a2d97290f72b10525f8515215276495f10c79267526c?d=identicon)[FaustVik](/maintainers/FaustVik)

---

Tags

httpphprouterroutinghttpphprouterrouting

###  Code Quality

Static AnalysisPsalm

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[wilaak/radix-router

High-performance radix tree based HTTP request router

612.8k5](/packages/wilaak-radix-router)[aphiria/aphiria

The Aphiria framework

1427.7k2](/packages/aphiria-aphiria)

PHPackages © 2026

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