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

ActiveLibrary[Framework](/categories/framework)

webhoanhao/simple-router
========================

A very simple and small PHP router for url routing in your project.

1.0.1(5y ago)013MITPHPPHP &gt;=5.6.0

Since Mar 29Pushed 5y ago1 watchersCompare

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

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

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

[](#simple-router)

SimpleRouter
------------

[](#simplerouter)

A very simple and small PHP router for url routing in your project.

### Simple example:

[](#simple-example)

```
// code in: ./public/index.php

// Require the router class
include '../src/Route.php';

// Require the controller class (change path to match your project)
include '../app/Controllers/HomeController.php';

// Use router namespace
use WebHoanHao\SimpleRouter\Route;

// Use app namespace (change namespace to match your project)
use App\Controllers\HomeController;

// Add your routes
Route::add('/', HomeController::class,'index','index-route-name');
Route::add('/hello', HomeController::class,'hello','hello-route-name');
Route::add('/product-detail', ProductController::class,'detail','product-detail');
// ....

// Run the router
Route::run();
```

### Example with Composer

[](#example-with-composer)

For installation, just run `composer require webhoanhao/simple-router`

Then add the autoloader to your project like this:

```
// code in: ./public/index.php

// Autoload files using composer
require_once __DIR__ . '/../vendor/autoload.php';

// Use router namespace
use WebHoanHao\SimpleRouter\Route;

// Use app namespace (change namespace to match your project)
use App\Controllers\HomeController;

// Add your routes
Route::add('/', HomeController::class,'index','index-route-name');
Route::add('/hello', HomeController::class,'hello','hello-route-name');
Route::add('/product-detail', ProductController::class,'detail','product-detail');
// ....

// Run the router
Route::run();
```

### Get URL from route BY NAME

[](#get-url-from-route-by-name)

```
$url = Route::url('routeName');
```

If there are some params

```
$url = Route::url('routeName',[$param_1,2,'param3']);
```

### Get params in target method

[](#get-params-in-target-method)

```
    public function detail($param1, $param2, $param3)
    {
        echo "Param1 = ".$param1;
        echo "Param2 = ".$param2;
        echo "Param3 = ".$param3;
    }
```

### License

[](#license)

This project is licensed under the MIT License. See LICENSE for further information.

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity48

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

Total

2

Last Release

1867d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/79940bb908f867e148b9108da824fe9a2f60488bea58a6cb75cd9541562d50b9?d=identicon)[webhoanhao](/maintainers/webhoanhao)

---

Top Contributors

[![webhoanhao](https://avatars.githubusercontent.com/u/20508195?v=4)](https://github.com/webhoanhao "webhoanhao (12 commits)")

### Embed Badge

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

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

###  Alternatives

[laravel/telescope

An elegant debug assistant for the Laravel framework.

5.2k67.8M192](/packages/laravel-telescope)[spiral/roadrunner

RoadRunner: High-performance PHP application server and process manager written in Go and powered with plugins

8.4k12.2M84](/packages/spiral-roadrunner)[nolimits4web/swiper

Most modern mobile touch slider and framework with hardware accelerated transitions

41.8k177.2k1](/packages/nolimits4web-swiper)[laravel/dusk

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

1.9k36.7M256](/packages/laravel-dusk)[laravel/prompts

Add beautiful and user-friendly forms to your command-line applications.

708181.8M593](/packages/laravel-prompts)[cakephp/chronos

A simple API extension for DateTime.

1.4k47.7M121](/packages/cakephp-chronos)

PHPackages © 2026

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