PHPackages                             elcapitansponge/phlounder - 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. elcapitansponge/phlounder

AbandonedArchivedLibrary[Framework](/categories/framework)

elcapitansponge/phlounder
=========================

Minimalistc semi-opinionated PHP router

v0.1.1(2y ago)12[2 issues](https://github.com/ElCapitanSponge/phlounder/issues)MITPHPPHP &gt;=8.3

Since Mar 17Pushed 2y ago1 watchersCompare

[ Source](https://github.com/ElCapitanSponge/phlounder)[ Packagist](https://packagist.org/packages/elcapitansponge/phlounder)[ Docs](https://github.com/ElCapitanSponge/phlounder)[ RSS](/packages/elcapitansponge-phlounder/feed)WikiDiscussions main Synced yesterday

READMEChangelog (2)Dependencies (3)Versions (3)Used By (0)

PHlounder
=========

[](#phlounder)

Minimalistic opinionated PHP Routing engine

[![PHP](https://camo.githubusercontent.com/b5f049288f64c6d87a1b492b5b8ccb9305c31044edd0d7bb4a17a25936d1a75d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f504850253230382e332b2d707572706c652e7376673f7374796c653d666f722d7468652d6261646765266c6f676f3d706870)](https://www.php.net)

⇁ About
-------

[](#-about)

A minimalistic routing engine for PHP allowing route parameters for GET, POST, PUT, DELETE and OPTIONS. The only thing missing is **your code**.

⇁ Installation
--------------

[](#-installation)

### Composer

[](#composer)

```
composer require elcapitansponge/phlounder
```

### Git

[](#git)

**NOTE** As this is still in development cloning the repo is the way to go.

```
git clone https://github.com/ElCapitanSponge/phlounder.git
```

or

```
git clone git@github.com:ElCapitanSponge/phlounder.git
```

⇁ Getting Started
-----------------

[](#-getting-started)

### Calling the library

[](#calling-the-library)

Include the library in your script

#### Composer

[](#composer-1)

```
require __DIR__ . "/vendor/autoload.php"
```

#### Git Clone

[](#git-clone)

Alternitively you can load the files using the following snippet

```
$phlounder_path = "./phlounder/";

foreach (glob("{$phlounder_path}src/**/*.php") as $filename) {
    include $filename;
}
foreach (glob("{$phlounder_path}src/*.php") as $filename) {
    include $filename;
}
```

### Using the library

[](#using-the-library)

An example implementation of phlounder is as follows

```
use phlounder\Router;
use phlounder\lib\ResponseCodes;
use phlounder\router\Request;
use phlounder\router\Response;

$router = new Router();

$router->get("/", function (Request $req, Response $res) {
    $res->to_json(ResponseCodes::OK, "Hello World!");
});

$router->get("/user/{id}", function (Request $req, Response $res) {
    $data = new \stdClass();
    $data->params = $req->get_params();
    $res->to_json(ResponseCodes::OK, $data);
});

$router->post("/user", function (Request $req, Response $res) {
    $res->to_json(ResponseCodes::CREATED);
});

$router->put("/user/{id}", function (Request $req, Response $res) {
    $res->to_json(ResponseCodes::OK);
});

$router->delete("/user/{id}", function (Request $req, Response $res) {
    $res->to_json(ResponseCodes::OK);
});

$router->none_found();
```

### Route Handling

[](#route-handling)

The routing due to the nature of implementation follows the order of precidence. In otherwords, a top to bottom approach when processing.

This is apparent with the following snippet:

```
$router->get("/user/{id}", function (Request $req, Response $res) {
    $data = new \stdClass();
    $data->params = $req->get_params();
    $res->to_json(ResponseCodes::OK, $data);
});

$router->get("/user/foo", function (Request $req, Response $res) {
    $res->to_json(ResponseCodes::OK, "Bar!");
});
```

In the above snippet if you hit `/user/foo`You don't recieve:

```
{
    "code": 200,
    "data": "Bar!"
}
```

Instead you recieve:

```
{
    "code": 200,
    "data": {
        "params": {
            "id": "foo"
        }
    }
}
```

To resolve this issue we have to place the `/user/foo` route before `/user/{id}`

```
$router->get("/user/foo", function (Request $req, Response $res) {
    $res->to_json(ResponseCodes::OK, "Bar!");
});

$router->get("/user/{id}", function (Request $req, Response $res) {
    $data = new \stdClass();
    $data->params = $req->get_params();
    $res->to_json(ResponseCodes::OK, $data);
});
```

### Route paramater types

[](#route-paramater-types)

There is type handling for `string` or `int` in the route params if desired.

Taking the following:

```
$router->get("/users/{id:i}", function (Request $req, Response $res) {
    $data = new \stdClass();
    $data->params = $req->get_params();
    $res->to_json(ResponseCodes::OK, $data);
});

$router->get("/course/{code:s}", function (Request $req, Response $res) {
    $data = new \stdClass();
    $data->params = $req->get_params();
    $res->to_json(ResponseCodes::OK, $data);
});

$router->get("/category/{id}", function (Request $req, Response $res) {
    $data = new \stdClass();
    $data->params = $req->get_params();
    $res->to_json(ResponseCodes::OK, $data);
});
```

- `/users/{id:i}`: The `id` param is specified to be an `int`
- `/course/{code:s}`: The `code` param is specified to be a `string`
- `/category/{id}`: The `id` param can be either a `string` or an `int`

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity48

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

Total

2

Last Release

837d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5303562?v=4)[Andrew Brunker](/maintainers/ElCapitanSponge)[@ElCapitanSponge](https://github.com/ElCapitanSponge)

---

Top Contributors

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

---

Tags

routing

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/elcapitansponge-phlounder/health.svg)

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

###  Alternatives

[klein/klein

A lightning fast router for PHP

2.7k1.1M30](/packages/klein-klein)[nette/application

🏆 Nette Application: a full-stack component-based MVC kernel for PHP that helps you write powerful and modern web applications. Write less, have cleaner code and your work will bring you joy.

45715.9M1.1k](/packages/nette-application)[laravel/folio

Page based routing for Laravel.

603583.7k32](/packages/laravel-folio)[pecee/simple-router

Simple, fast PHP router that is easy to get integrated and in almost any project. Heavily inspired by the Laravel router.

675231.0k18](/packages/pecee-simple-router)[vlucas/bulletphp

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

41750.0k1](/packages/vlucas-bulletphp)[luthier/luthier

Improved routing, middleware support, authentication tools and more for CodeIgniter 3 framework

153125.0k](/packages/luthier-luthier)

PHPackages © 2026

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