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

ActiveLibrary[Framework](/categories/framework)

hexan45/router
==============

Easy to use and simply PHP router

v1.0.0(3y ago)010MITPHP

Since Dec 19Pushed 3y ago1 watchersCompare

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

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

PHP router library
==================

[](#php-router-library)

router library created with PHP language

Installation
------------

[](#installation)

Assuming you don't have initialized `composer.json` file. You must execute code given under below.

```
composer init
composer require hexan45/s-router:dev-main
```

In main project folder create .htaccess file and paste this code

```
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php?request=%{THE_REQUEST} [L]
```

To start using library create file named `index.php` in your root directory and use build in `include()` or `require()` function to include autoloading PSR-4 file named `autoload.php`.

Usage
-----

[](#usage)

In `index.php` file you must import router class by enter this code `use Router/Route;`

**Create Route class instance**

```
$Route = new Route();
```

**Register path for GET uri method**

```
$Route->Get(routePath: '/', routeController: callbackFunction());
or
$Route->Get(routePath: '/', routeController: [somethingControllerClass::class, 'somethingControllerMethod']);
or
$Route->Get(routePath: '/', routeController: 'somethingControllerClass@somethingControllerMethod');
```

**Register path for POST uri method**

```
$Route->Post(routePath: '/', routeController: callbackFunction());
or
$Route->Post(routePath: '/', routeController: [somethingControllerClass::class, 'somethingControllerMethod']);
or
$Route->Post(routePath: '/', routeController: 'somethingControllerClass@somethingControllerMethod');
```

**Register dynamic routes**

```
$Route->Post(routePath: '/article/$id', routeController: callbackFunction($id));
or
$Route->Post(routePath: '/some/$someID/thing/$thingID', routeController: callbackFunction($someID, $thingID));
```

Important thing! You must add the same names in callbackFunctions/methods parameters as in routePath.

*Example*

`$Route->Post(routePath: '/article/$id', 'AdminController@index');`

So in AdminController class, your index method should look like this

`public function index($id) {...someCode}`

Methods arguments
-----------------

[](#methods-arguments)

**Get**

- `routePath (string)` - Path of uri which will be register in router
- `routeController (callable|array|string)` - Code access details which specify code to run when user enter registered route path

**Post**

- `routePath (string)` - Path of uri which will be register in router
- `routeController (callable|array|string)` - Code access details which specify code to run when user enter registered route path

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

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

Unknown

Total

1

Last Release

1244d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/15d40d2177d1584ef1c382a1bcd650d1dfa7383e75ab790b838c2cc0205cc2e7?d=identicon)[Hexan45](/maintainers/Hexan45)

---

Top Contributors

[![Hexan45](https://avatars.githubusercontent.com/u/95004146?v=4)](https://github.com/Hexan45 "Hexan45 (10 commits)")

### Embed Badge

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

```
[![Health](https://phpackages.com/badges/hexan45-router/health.svg)](https://phpackages.com/packages/hexan45-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.7M259](/packages/laravel-dusk)[laravel/prompts

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

708181.8M596](/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)
