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

ActiveLibrary[Framework](/categories/framework)

mamphir/extreemly-simple-router
===============================

Very simple PHP router that can easly be integrated on your app and easly modified to fit your needs

V1.0.0(5y ago)07MITPHPPHP &gt;=7.2

Since Mar 28Pushed 5y ago1 watchersCompare

[ Source](https://github.com/halilkerimi/extreemly-simple-router)[ Packagist](https://packagist.org/packages/mamphir/extreemly-simple-router)[ RSS](/packages/mamphir-extreemly-simple-router/feed)WikiDiscussions master Synced 2d ago

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

Extreemly Simple Router
=======================

[](#extreemly-simple-router)

This is an PHP class that can help to add router on your PHP project. Main ideas is to create PHP router as simple as it gets, that can be integrated in your project and easy to be edited for your needs.

Usage
-----

[](#usage)

Import `router.php` in your project and create an instance of `Router` class. Add route to the instance using `addRoute` method by providing:

- Route : define a route to match
- Method : method of request to apply for
- Handler : handler function that accepts array of arguments, this arry will be provided as key value pair when route matches

```
//import Router class
require_once("./router.php");

//create instance of Router
$router = new \ESRouter\Router();

//define new route
$router->addRoute("/user/{name}/post/{id:[0-9]}", "get", function ($args) {
    //handle request as you need
    $name = $args['name'];
    $id = $args['id'];
    print $name.$id ;
});

//define another route
$router->addRoute("/", "get", function ($args) {
    //handle request as you need
    print "Welcome home" ;
});

//more routes
//...

//optional
//Setting 404 handler
$router->setE404(function(){
    echo "this is 404";
});

$router->run();
```

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

[](#defining-routes)

To define route, start with `/` and for static rout use plain text example `user` or for variable use `{name}` ad it fill match anything in between `/` and `/` or end of route, in case you want to use RegEx use `{varname:RegEx}` where *name* is the name of variable and *RegEx* is a RegEx expression to match

Matching Routes
---------------

[](#matching-routes)

Routes are matchef rom the first defined route to the last, if a route is matched than it will execute the handler and will stop searching for other routes.

```
//Example
//In this case if we call http:///user/nameOfTheUser/post/1234

$router->addRoute("/user/{name}/post/{id:\d{4}}", "get", function ($args) {
    print 'First route';
});

$router->addRoute("/user/{name}/post/{id:[0-9]}", "get", function ($args) {
    print 'Second route';
});

//First Route will be called
```

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

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

1871d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3e49d07e789aa37b61c726e65b8df3522230888a4e22a02a697116ace812b941?d=identicon)[Mamphir](/maintainers/Mamphir)

---

Tags

phpphp-routerroutersimple

### Embed Badge

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

```
[![Health](https://phpackages.com/badges/mamphir-extreemly-simple-router/health.svg)](https://phpackages.com/packages/mamphir-extreemly-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.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)
