PHPackages                             splashsky/simplerouter - 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. splashsky/simplerouter

ActiveLibrary[Framework](/categories/framework)

splashsky/simplerouter
======================

A very light, easy-to-use router for small PHP apps.

v2.4.6(4y ago)3221[2 issues](https://github.com/splashsky/simplerouter/issues)[1 PRs](https://github.com/splashsky/simplerouter/pulls)MITPHP

Since Jan 14Pushed 3y ago1 watchersCompare

[ Source](https://github.com/splashsky/simplerouter)[ Packagist](https://packagist.org/packages/splashsky/simplerouter)[ RSS](/packages/splashsky-simplerouter/feed)WikiDiscussions master Synced 1w ago

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

SimpleRouter
============

[](#simplerouter)

Aloha! SimpleRouter is a super-small, lightweight, and easy-to-use router for your PHP project. It can handle any type of request, and features RegEx pattern matching for URI parameters. You can also easily define routes for 404 and 405 errors.

As this implementation is very simple, it works great as boilerplate for a more complicated router if your project demands it. I created this to serve as a basic router for a small RPG game in PHP. Let me know what you use it for in the Discussions tab!

Usage
-----

[](#usage)

```
// Include the class... (this can also be done via autoloading)
include 'src\Splashsky\Router.php';

// Use the namespace...
use Splashsky\Router;

// Add the first GET route...
Router::get('/user/{id}/edit', function ($id) {
    return 'Edit user with id '.$id.'';
});

// Run the router!
Router::run();
```

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

[](#installation)

The easiest way to use SimpleRouter is to install it in your project via Composer.

```
composer require splashsky/simplerouter-php
```

Otherwise, download the latest Release and use `include` or `require` in your code.

Caveats
-------

[](#caveats)

Using SimpleRouter is... simple! There's a couple of principles to note, however.

### Root Route

[](#root-route)

You can't have an empty route (`Router::get('', ...);`), as the router **always assumes you at least have a `/` in your URI**. The root route should always be `/`, such as in `Router::get('/', function () {});`.

### Parameters are in order they appear

[](#parameters-are-in-order-they-appear)

In the example of `/api/hello/{name}`, your first instinct when getting this parmeter in your action is that the variable will be named `$name`. This isn't the case - route parameters are in the order they are found in the route, and names are irrelevant.

Routing for subfolders
----------------------

[](#routing-for-subfolders)

If you're wanting to route for seperate uses (such as an api), you can create another entrypoint (in `/api/v1` for example) and pass a custom base path to the router.

```
Router::run('/api/v1');
```

Ensure that your web server points traffic from `/api/v1` to this entrypoint appropriately.

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

[](#contributing)

I'm happy to look over and review any Issues or Pull Requests for this project. If you've run into a problem or have an enhancement or fix, submit it! It's my goal to answer and review everything within 48 hours.

Credit
------

[](#credit)

Most of the code so far has been initially written by [@SteamPixel](https://github.com/steampixel), so make sure to give him a follow or a star on the original repo as well. Thanks!

License
-------

[](#license)

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

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance7

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 88.2% 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 ~44 days

Total

17

Last Release

1611d ago

Major Versions

0.7.0 → 1.0.02021-07-14

1.0.0 → v2.0.02021-07-15

### Community

Maintainers

![](https://www.gravatar.com/avatar/21d2a3d664d9717c20fdbad24664fb850e2d543c7b0ab65cc1776ee52efa04e7?d=identicon)[Skylear](/maintainers/Skylear)

---

Top Contributors

[![steampixel](https://avatars.githubusercontent.com/u/2643394?v=4)](https://github.com/steampixel "steampixel (75 commits)")[![ImMaax](https://avatars.githubusercontent.com/u/40642083?v=4)](https://github.com/ImMaax "ImMaax (5 commits)")[![syrian-dev](https://avatars.githubusercontent.com/u/16126451?v=4)](https://github.com/syrian-dev "syrian-dev (2 commits)")[![beopuppy](https://avatars.githubusercontent.com/u/3517405?v=4)](https://github.com/beopuppy "beopuppy (1 commits)")[![mzaini30](https://avatars.githubusercontent.com/u/7939342?v=4)](https://github.com/mzaini30 "mzaini30 (1 commits)")[![splashsky](https://avatars.githubusercontent.com/u/12104206?v=4)](https://github.com/splashsky "splashsky (1 commits)")

---

Tags

phpphp-routerroutersimpleurl-parser

### Embed Badge

![Health badge](/badges/splashsky-simplerouter/health.svg)

```
[![Health](https://phpackages.com/badges/splashsky-simplerouter/health.svg)](https://phpackages.com/packages/splashsky-simplerouter)
```

###  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)
