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

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

viloveul/router
===============

Http Router for handling request path

v1.0.11(6y ago)11841MITPHPPHP ~7.0

Since Dec 29Pushed 6y ago1 watchersCompare

[ Source](https://github.com/viloveul/router)[ Packagist](https://packagist.org/packages/viloveul/router)[ Docs](http://www.viloveul.com)[ RSS](/packages/viloveul-router/feed)WikiDiscussions master Synced today

READMEChangelog (10)Dependencies (3)Versions (14)Used By (1)

[![Build Status](https://camo.githubusercontent.com/52cce2235e13af3a49e77c9c5e61c0b84964f3bb4c79facff756b83d48ddb9dd/68747470733a2f2f7472617669732d63692e636f6d2f76696c6f7665756c2f726f757465722e737667)](https://travis-ci.com/viloveul/router)[![Total Downloads](https://camo.githubusercontent.com/067334cbb1110647da3ecaf43617c6d4b931f9dbae192c2305fb2e3d0387a901/68747470733a2f2f706f7365722e707567782e6f72672f76696c6f7665756c2f726f757465722f642f746f74616c2e737667)](https://packagist.org/packages/viloveul/router)[![Latest Stable Version](https://camo.githubusercontent.com/f92c71de762eef8b43399e3e10843c9a343c11ab7984208ed209fa43f72083eb/68747470733a2f2f706f7365722e707567782e6f72672f76696c6f7665756c2f726f757465722f762f737461626c652e737667)](https://packagist.org/packages/viloveul/router)

Installation
============

[](#installation)

make sure your php version &gt; 7.0

```
composer require viloveul/router
```

HOW
---

[](#how)

```
require __DIR__ . '/vendor/autoload.php';

// init collection object
$collection = new Viloveul\Router\Collection();

// declare class controller for handler
class MyController
{
	public function look($name)
	{
		return $name;
	}
}

// declare hello handler from my controller
$helloRoute = new Viloveul\Router\Route('GET /hello/:name', [MyController::class, 'look']);
// or
// $helloRoute = new Viloveul\Router\Route('GET /hello/:name', [MyController::class, 'look']);
// add foo to collection
$collection->add($helloRoute);

// declare foo handler
$fooRoute = new Viloveul\Router\Route('GET /foo/{:bar}', function($bar) {
	return $bar;
});
// add foo to collection
$collection->add($fooRoute);

// declare test handler
$testRoute = new Viloveul\Router\Route('/test/:name', [
	'method' => 'GET|POST|PUT|PATCH',
	'handler' => function ($name) {
		return $name;
	}
]);
// add test to collection
$collection->add($testRoute);

// init object dispatcher with collection
$router = new Viloveul\Router\Dispatcher($collection);

// in action

$router->dispatch('GET', Zend\Diactoros\UriFactory::createUri('/hello/zafex'));
$route1 = $router->routed();

$router->dispatch('GET', Zend\Diactoros\UriFactory::createUri('/foo/hello-world'));
$route2 = $router->routed();

$router->dispatch('GET', Zend\Diactoros\UriFactory::createUri('/test/fajrul-akbar-zuhdi'));
$route3 = $router->routed();

var_dump($route1, $route2, $route3);
```

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity63

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

Total

13

Last Release

2528d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/609a03f1a38d80aa5cf333dd556cb748371dbcbc880f3c580ecea72ff0fb228b?d=identicon)[zafex](/maintainers/zafex)

---

Top Contributors

[![zafex](https://avatars.githubusercontent.com/u/12587685?v=4)](https://github.com/zafex "zafex (36 commits)")

---

Tags

componentphprouterviloveulviloveul-frameworkrouterlibrarycomponentzafexviloveulfajrulaz

###  Code Quality

TestsCodeception

### Embed Badge

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

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

###  Alternatives

[bephp/router

A fast router for PHP. It matches urls and executes PHP functions. automatic get variable based on handler function parameter list. Suport to compile router callback handlers into plain array source code.

1611.1k2](/packages/bephp-router)

PHPackages © 2026

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