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

ActiveLibrary[Framework](/categories/framework)

fastpress/router
================

A simple yet powerful routing component for the Fastpress framework, enabling efficient HTTP routing in PHP applications.

v0.2.0(1mo ago)0761MITPHPPHP ^8.0

Since Feb 14Pushed 1mo ago1 watchersCompare

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

READMEChangelogDependencies (6)Versions (5)Used By (1)

Fastpress Router
================

[](#fastpress-router)

The Fastpress Router is a powerful and flexible routing system for PHP applications. It provides a simple and intuitive way to define routes, handle HTTP requests, and manage the flow of your web application.

Features
--------

[](#features)

- Support for multiple HTTP methods (GET, POST, PUT, DELETE, PATCH, OPTIONS, HEAD)
- Route parameters with custom patterns
- Named routes for easy URL generation
- Route groups for shared attributes
- Middleware support
- Route constraints
- Optional parameters
- Conflict detection to prevent ambiguous routes

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

[](#installation)

To use the Fastpress Router in your project, you can include it in your PHP files:

```
use Fastpress\Routing\Router;

require_once 'path/to/Router.php';
```

Basic Usage
===========

[](#basic-usage)

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

[](#defining-routes)

```
$router = new Router();

// Define a simple GET route
$router->get('/hello', function() {
    echo "Hello, World!";
});

// Define a POST route with parameters
$router->post('/users/{id}', 'UserController@update');
```

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

[](#matching-routes)

```
$match = $router->match($_SERVER, $_POST);

if ($match) {
    $handler = $match['handler'];
    $params = $match['params'];

    // Execute the handler with the matched parameters
    // ...
} else {
    // No matching route found
    // Handle 404 Not Found
}
```

Advanced Usage
==============

[](#advanced-usage)

Route Groups
------------

[](#route-groups)

```
$router->group(['prefix' => 'admin', 'middleware' => ['auth']], function($router) {
    $router->get('/dashboard', 'AdminController@dashboard');
    $router->get('/users', 'AdminController@users');
});
```

Named Routes
------------

[](#named-routes)

```
$router->get('/profile/{id}', 'ProfileController@show')->name('profile.show');

// Generate URL for named route
$url = $router->getNamedRoute('profile.show', ['id' => 123]);
```

Custom Route Parameters
-----------------------

[](#custom-route-parameters)

```
$router->addPattern('uuid', '[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}');

$router->get('/users/{uuid}', 'UserController@show');
```

Middleware
----------

[](#middleware)

```
$router->get('/admin/dashboard', 'AdminController@dashboard')
    ->middleware('auth');
```

Route Constraints
-----------------

[](#route-constraints)

```
$router->get('/users/{id}', 'UserController@show')
    ->where(['id' => '\d+']);
```

Contributing
============

[](#contributing)

Contributions are welcome! Please feel free to submit a Pull Request. License This Fastpress Router is open-sourced software licensed under the MIT license.

###  Health Score

39

—

LowBetter than 84% of packages

Maintenance92

Actively maintained with recent releases

Popularity9

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity40

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

Total

4

Last Release

37d ago

PHP version history (2 changes)0.1.0PHP ^7.4 || ^8.0

v0.2.0PHP ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/8224efc6c85f9ed635239195b886766f000c05d279ba93124dcc361c235efdf7?d=identicon)[samayo](/maintainers/samayo)

---

Top Contributors

[![samayo](https://avatars.githubusercontent.com/u/5304093?v=4)](https://github.com/samayo "samayo (11 commits)")

---

Tags

httpphpframeworkrouterroutingfastpress

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[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)[developermarius/simple-router

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

112.5k](/packages/developermarius-simple-router)

PHPackages © 2026

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