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

ActiveLibrary[Framework](/categories/framework)

refkinscallv/router
===================

PHP Routing Library provides a flexible and easy-to-use routing system for PHP application

1.0.9(1y ago)046MITPHPPHP &gt;=7.4

Since Aug 4Pushed 1y ago1 watchersCompare

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

READMEChangelog (4)DependenciesVersions (5)Used By (0)

RF PHP Routing Library
======================

[](#rf-php-routing-library)

Overview
--------

[](#overview)

The RF PHP Routing Library provides a flexible and easy-to-use routing system for PHP applications. It supports registering routes from separate files, setting maintenance and 404 page handlers, and defining routes with various HTTP methods. Additionally, it supports route grouping for organizing routes under a common prefix.

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

[](#installation)

1. **Install via Composer**

    Make sure you have Composer installed. Run the following command to add the RF PHP Routing Library to your project:

    ```
    composer require refkinscallv/router
    ```
2. **Autoload Dependencies**

    Ensure that your project’s `vendor/autoload.php` is required in your application entry point.

    ```
    require 'vendor/autoload.php';
    ```

Usage
-----

[](#usage)

### Importing the Library

[](#importing-the-library)

Before using the routing methods, you need to import the `Route` class from the `RF\Router` namespace. This is done with the `use` statement:

```
use RF\Router\Route;
```

This line of code allows you to use the `Route` class methods without needing to write the full namespace each time.

### 1. Register Routes from Separate Files

[](#1-register-routes-from-separate-files)

You can register routes from different files using the `Route::register` method:

```
Route::register([
    'example/route/other'
]);
```

### 2. Global Settings

[](#2-global-settings)

#### Maintenance Page

[](#maintenance-page)

Define a maintenance page handler:

```
Route::setMaintenance(function() {
    echo "Maintenance Page";
});

// OR

require 'example/page/maintenance.php';
Route::setMaintenance([RF\Page\Maintenance::class, 'index']);
```

#### 404 Page

[](#404-page)

Define a 404 page handler:

```
Route::set404(function() {
    echo "Page Not Found";
});

// OR

require 'example/page/page404.php';
Route::set404([RF\Page\Page404::class, 'index']);
```

### 3. Basic Route Usage

[](#3-basic-route-usage)

Define routes with different HTTP methods:

```
Route::get('', function() {
    echo "Default Page";
});

// OR

require 'example/page/default.php';
Route::get('', [RF\Page\DefaultPage::class, 'index']);
```

#### HTTP Methods

[](#http-methods)

- `Route::set` - General method for setting routes (default is GET)
- `Route::get` - GET request
- `Route::post` - POST request
- `Route::put` - PUT request
- `Route::delete` - DELETE request
- `Route::patch` - PATCH request
- `Route::options` - OPTIONS request

### 4. Route with Parameters

[](#4-route-with-parameters)

Define routes with optional or required parameters. Optional parameters are denoted with a `?` in the route pattern, indicating that the parameter is not required and can be omitted in the URL.

#### Example

[](#example)

Define a route with an optional parameter:

```
Route::get('/param/{id?}', function($id) {
    echo 'Add param: ' . ($id ? $id : 'No parameter provided');
});
```

#### Usage

[](#usage-1)

- **With Parameter:**

    URL: `/param/123`
    Output: `Add param: 123`
- **Without Parameter:**

    URL: `/param`
    Output: `Add param: No parameter provided`

### 5. Route Groups

[](#5-route-groups)

Group routes under a common prefix:

```
Route::group(['prefix' => '/parent/path'], function() {
    Route::get("", function() {
        echo "Default Page for /parent/path";
    });

    Route::get("/child", function() {
        echo "Path /child page of /parent/path";
    });
});
```

### 5. Run the Router

[](#5-run-the-router)

Finally, execute the router to handle incoming requests:

```
Route::run();
```

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

[](#contributing)

If you would like to contribute to the development of this library, please submit a pull request or open an issue on GitHub.

License
-------

[](#license)

This library is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance38

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity43

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

Total

4

Last Release

539d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/917507a2999e41550fc4cd87473549eccd1f3099a08c44c22dd82c263c16b282?d=identicon)[refkinscallv](/maintainers/refkinscallv)

---

Top Contributors

[![refkinscallv](https://avatars.githubusercontent.com/u/31750609?v=4)](https://github.com/refkinscallv "refkinscallv (9 commits)")

---

Tags

phpphp-libraryphp-routerphp-router-standalonephp-routingrouterrouting

### Embed Badge

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

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

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