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

ActiveLibrary[Framework](/categories/framework)

chahal26/php-simple-router
==========================

Simple Routing made with OOPS in PHP

2.0(3y ago)038MITPHPPHP &gt;=8.0.0

Since Jan 12Pushed 3y ago1 watchersCompare

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

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

chahal26/php-simple-router
==========================

[](#chahal26php-simple-router)

A simple &amp; lightweight PHP Router made with Object Oriented PHP. Built with ❤️ by [Sahil Chahal](https://github.com/chahal26)

It currently supports static routes only.

Prerequisites/Requirements
--------------------------

[](#prerequisitesrequirements)

- PHP &gt;= 8.0
- [URL Rewriting](https://gist.github.com/chahal26/b6233a6e6a93321c6eae0a05ba9954b5)

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

[](#installation)

`chahal26/php-simple-router` can be easily installed using

```
    composer require chahal26/php-simple-router
```

Usage
-----

[](#usage)

Create an instance of `\Chahal26\PhpSimpleRouter\Router`, define some routes, and run it.

```
    require_once 'vendor/autoload.php';

    use Chahal26\PhpSimpleRouter\Router;

    /* Creating Route Instance */
    $router = new Router();

    /* Defining Routes */

    /* Execute Routes */
    $router->run();
```

Available Routing Methods
-------------------------

[](#available-routing-methods)

- GET
- POST

Defining Routes
---------------

[](#defining-routes)

### Static Routes

[](#static-routes)

```
$router->get('route', function() { /* ... */ });
$router->post('route', function() { /* ... */ });
```

### With Controller

[](#with-controller)

```
    $router->get('/about', '\App\Controllers\PagesController@about');
```

Or a namespace can also be defined

```
    $router->setNamespace('\App\Controllers');
    $router->get('/about', 'PagesController@about');
```

Example
-------

[](#example)

```
    $router->get('/', function(){
        echo "Welcome To Home Page";
    });

    $router->get('/contact', function(){
        echo "Welcome To Contact Page";
    });
```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity55

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

Total

3

Last Release

1211d ago

Major Versions

1.0.0 → 2.02023-01-15

### Community

Maintainers

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

---

Top Contributors

[![chahal26](https://avatars.githubusercontent.com/u/91047757?v=4)](https://github.com/chahal26 "chahal26 (37 commits)")

---

Tags

phprouterroutingrouterroutingphp-router

### Embed Badge

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

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

###  Alternatives

[klein/klein

A lightning fast router for PHP

2.7k1.1M31](/packages/klein-klein)[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)[vlucas/bulletphp

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

41949.9k1](/packages/vlucas-bulletphp)[izniburak/router

simple router class for php

23522.6k7](/packages/izniburak-router)[vectorface/snappy-router

A quick and snappy routing framework.

4614.7k](/packages/vectorface-snappy-router)[thewunder/croute

Convention based routing for PHP

1317.4k](/packages/thewunder-croute)

PHPackages © 2026

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