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.

0.1.2(1y ago)0651MITPHPPHP ^7.4 || ^8.0

Since Feb 14Pushed 1y 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 1mo ago

READMEChangelogDependencies (3)Versions (4)Used By (1)

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

[](#fastpress-router)

Fastpress Router is a simple yet powerful routing class for PHP, part of the Fastpress framework. It allows you to define routes for your application and handle HTTP requests efficiently.

Features
--------

[](#features)

- Supports GET, POST, PUT, and DELETE HTTP methods.
- Easy definition of route patterns.
- Supports RESTful routing.
- Customizable route patterns.

Requirements
------------

[](#requirements)

- PHP 7.0 or higher.

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

[](#installation)

Insert instructions for installing this router class or the Fastpress framework.

Usage
-----

[](#usage)

### Basic Usage

[](#basic-usage)

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

$router = new Fastpress\Routing\Router();

// Define a GET route
$router->get('/home', function() {
    return 'Welcome to the homepage!';
});

// Handle the request
// Assuming $server and $post are your $_SERVER and $_POST variables
$result = $router->match($server, $post);

if ($result) {
    // Route was matched
    list($args, $callable) = $result;
    call_user_func_array($callable, $args);
} else {
    // No route was matched
    header("HTTP/1.0 404 Not Found");
}
```

### Defining Routes

[](#defining-routes)

You can define routes for different HTTP methods:

```
$router->get($uri, $callable);
$router->post($uri, $callable);
$router->put($uri, $callable);
$router->delete($uri, $callable);
```

### Route Patterns

[](#route-patterns)

You can use the following placeholders in your route patterns:

- :any - Matches any characters
- :id - Matches numeric characters
- :slug - Matches alphanumeric characters, dashes, and underscores
- :name - Matches alphabetic characters
- :url - Matches alphanumeric characters and URL-friendly symbols

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

[](#contributing)

Contributions are welcome! Please feel free to submit a pull request or open issues to improve the library.

License
-------

[](#license)

This library is open-sourced software licensed under the MIT license.

Support
-------

[](#support)

If you encounter any issues or have questions, please file them in the issues section on GitHub.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance42

Moderate activity, may be stable

Popularity8

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity38

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.

###  Release Activity

Cadence

Every ~175 days

Total

3

Last Release

474d ago

### 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 (2 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.

696214.6k17](/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.4k](/packages/developermarius-simple-router)

PHPackages © 2026

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