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

ActiveLibrary[Framework](/categories/framework)

np/router
=========

The simple router PHP

0.0.4(6y ago)0261MITPHPPHP &gt;=5.4.0

Since Aug 25Pushed 6y ago1 watchersCompare

[ Source](https://github.com/zenlykoi/simple-router-PHP)[ Packagist](https://packagist.org/packages/np/router)[ RSS](/packages/np-router/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (3)DependenciesVersions (5)Used By (0)

simple-router
=============

[](#simple-router)

The simple router PHP

install
-------

[](#install)

```
composer require np/router

```

```
require "vendor/autoload.php";
```

usage
-----

[](#usage)

```
use np\router;

$route = new router;

$route->get('/',function(){
     	echo 'GET method';
});
$route->post('/',function(){
	echo 'POST method';
});
$route->put('/',function(){
	echo 'PUT method';
});
$route->patch('/',function(){
	echo 'PATCH method';
});
$route->delete('/',function(){
	echo 'DELETE method';
});
$route->option('/',function(){
	echo 'OPTION method';
});
```

data in router
--------------

[](#data-in-router)

```
$route->get('/post/{id}',function($data){
	echo 'This is post page and id = '.$data['id'];
});
```

return view
-----------

[](#return-view)

```
function loadView($view){
	echo file_get_contents($view);
}
$route->get('/',function(){
	loadView('./dir_name');
});
```

listen (run)
------------

[](#listen-run)

```
$route->listen();
```

set callback when error(404)
----------------------------

[](#set-callback-when-error404)

```
$route->setCallbackError(function(){
	loadView('./404.php');
});
```

run server
----------

[](#run-server)

```
php -S localhost:8000
-> open localhost:8000

```

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity46

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

Total

4

Last Release

2237d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e2468328ed69f7aa033ecc0aa6f624df0ef1f7acda8de210936000eb155ab168?d=identicon)[zenlykoi](/maintainers/zenlykoi)

---

Top Contributors

[![zenlykoi](https://avatars.githubusercontent.com/u/42612129?v=4)](https://github.com/zenlykoi "zenlykoi (17 commits)")

---

Tags

frameworkrouterroutingSimplelibsimple-php-routerrequest-handlerurl-handlinginput-handlerrouting-enginenpnguyenphuong

### Embed Badge

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

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

###  Alternatives

[pecee/simple-router

Simple, fast PHP router that is easy to get integrated and in almost any project. Heavily inspired by the Laravel router.

696214.6k17](/packages/pecee-simple-router)[developermarius/simple-router

Simple, fast PHP router that is easy to get integrated and in almost any project. Heavily inspired by the Laravel router.

112.4k](/packages/developermarius-simple-router)[vlucas/bulletphp

A heierarchical resource-oriented micro-framework built on nested closures instead of route-based callbacks

41949.9k1](/packages/vlucas-bulletphp)

PHPackages © 2026

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