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

ActiveLibrary

amirkamizi/php-router
=====================

this is a simple router built during the php course

121PHP

Since Nov 16Pushed 3y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

Description
===========

[](#description)

This package was developed during [PHP Course - beginned to advance](index.phpoutube.com/@amirkamizichannel)

It's a router for PHP to handle the requests.

Support us
----------

[](#support-us)

to support me for the package or the course you can contact

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

[](#installation)

You can install the package via composer:

```
composer require amirkamizi/router
```

Usage
-----

[](#usage)

you need to have a .htaccess file to redired everything to index or any other file.

```
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+)$ index.php [QSA,L]
```

then inside that file you can use the router to handle the reuqies.

passing name of that file that is going to handle the request.

```
Router::handle("GET","/contact","contact.php");
```

or

```
Router::get("/contact","contact.php");
```

Or you can pass anonymous and predefined functions to handle the request

```
Router::handle("GET","/contact",function(){
    echo "contact me at info@amirkamizi.com";
});
```

or

```
function contactMe(){
    echo "contact me at info@amirkamizi.com";
}
Router::get("/contact","contactMe");
```

Testing
-------

[](#testing)

This was for learning purposes. Not tests has been written yet.

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Contribution guidelines will be written here or on a separate file like changelog. for now no contribution is accepted.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please contact me at  to report security vulnerabilities.

Credits
-------

[](#credits)

- [amirkamizi](index.phpithub.com/amirkamizi)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](index.phpd) for more information.

###  Health Score

15

—

LowBetter than 3% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity23

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/5901274083394f19fbd1d057276acbe95ce100a4bfffb9ec38c77a0d6486ee6d?d=identicon)[amirkamizi](/maintainers/amirkamizi)

---

Top Contributors

[![amirkamizi](https://avatars.githubusercontent.com/u/37651161?v=4)](https://github.com/amirkamizi "amirkamizi (1 commits)")

### Embed Badge

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

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

PHPackages © 2026

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