PHPackages                             bulveyz/router-php - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. bulveyz/router-php

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

bulveyz/router-php
==================

Simple router for light projects PHP

1.0(8y ago)92032MITPHP

Since Jun 12Pushed 4y agoCompare

[ Source](https://github.com/Bulveyz/router-php)[ Packagist](https://packagist.org/packages/bulveyz/router-php)[ RSS](/packages/bulveyz-router-php/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

BulveyzRouter
=============

[](#bulveyzrouter)

Very basic but functional router. It will be useful for simple projects, will help to implement the routing system quickly, as it is very easy and fast, you can use it both separately and in conjunction with other classes or patterns.

#### Install via composer

[](#install-via-composer)

```
composer require bulveyz/router-php

```

[Documentation](https://green-cats.github.io/router-php/)
---------------------------------------------------------

[](#documentation)

Example of use
--------------

[](#example-of-use)

```
use BulveyzRouter\Route;
use BulveyzRouter\Router;

Route::get('/home', function() {
  echo "Home";
});

Route::any('/user/{id}', function($param) {
  echo "User" . $param->id;
});

Route::post('/create/post', 'PostController@store');

Router::routeVoid();
```

Don't forget to enable redirecting all requests to index.php in .htaccess. Here is one example:
-----------------------------------------------------------------------------------------------

[](#dont-forget-to-enable-redirecting-all-requests-to-indexphp-in-htaccess-here-is-one-example)

```
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule .* index.php [L,QSA]

```

Usage
-----

[](#usage)

Connect the necessary classes for the router BulveyzRouter\\Route and BulveyzRouter\\Router can be connected separately (if you use singleton), but BulveyzRouter\\Route must be called and routes must be defined before BulveyzRouter\\Router::routeVoid(); And don't forget to call BulveyzRouter\\Router::routeVoid(); before defined routes.

### Example

[](#example)

#### index.php

[](#indexphp)

```
use BulveyzRouter\Router;

// Defained routes
require_once '../routes.php';

// Run router
Router::routeVoid();
```

#### routes.php

[](#routesphp)

```
use BulveyzRouter\Route;

Route::get('/home', function() {
    echo "Home";
});
```

Patterns for route
------------------

[](#patterns-for-route)

The parameters for the route are specified as {pattern}. The route should not have the same parameters, they should have different names.

### Examples

[](#examples)

```
Route::get('/user/{id}/{second_id}', function($params) {
    echo $params->id . $params->second_id;
});
```

#### With controller

[](#with-controller)

```
Route::get('/user/{id}/{second_id}', 'HomeController@index');

public function index($params)
{
    echo $params->id . $params->second_id;
}
```

Methods
-------

[](#methods)

This version supports only 3 methods:

- GET
- POST
- ANY

Set name for route
------------------

[](#set-name-for-route)

You can specify the name of the router and return it anywhere.

### Example

[](#example-1)

```
Route::get('/home', 'HomeController@index')->name('home.index');

echo \route('home.index'); // return '/home'
```

Change nampespace for controllers
---------------------------------

[](#change-nampespace-for-controllers)

Of course, you can change the namespace for controllers, by default it is App\\ .

### Example

[](#example-2)

```
Route::setNamespace('Your namespace');

"Route::setNamespace('Classes');"
```

Output all defained routes and other data
-----------------------------------------

[](#output-all-defained-routes-and-other-data)

```
var_dump(Route::routeList());

// Return namespace
echo Route::getNamespace()

// Return path for route
echo \route('routeName');

Route::get('/user', function (){
    // Return method this route
    echo Router::$method;

    // Return path this route
    echo Router::$route;

    // Return params this route (Array)
    var_dump(Router::$params);

    // Return handler this route
    var_dump(Router::$callback);
});
```

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 90% 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

Unknown

Total

1

Last Release

2941d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/34393239?v=4)[Bulveyz](/maintainers/Bulveyz)[@Bulveyz](https://github.com/Bulveyz)

---

Top Contributors

[![Bulveyz](https://avatars.githubusercontent.com/u/34393239?v=4)](https://github.com/Bulveyz "Bulveyz (18 commits)")[![green-cats](https://avatars.githubusercontent.com/u/62088807?v=4)](https://github.com/green-cats "green-cats (2 commits)")

---

Tags

phpphp-routerrouterrouting

### Embed Badge

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

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

###  Alternatives

[ffraenz/private-composer-installer

A composer install helper for private packages

2321.7M5](/packages/ffraenz-private-composer-installer)[yajra/laravel-datatables

Laravel DataTables Complete Package.

1036.3M57](/packages/yajra-laravel-datatables)[coderello/laravel-shared-data

Package for sharing data from Laravel to JavaScript.

31377.8k1](/packages/coderello-laravel-shared-data)[kartik-v/yii2-tabs-x

A supercharged Bootstrap tabs widget with ability to align tabs in multiple ways, add borders, rotated titles, and more.

311.4M22](/packages/kartik-v-yii2-tabs-x)[itonomy/productvisibilitygrid

3464.8k](/packages/itonomy-productvisibilitygrid)

PHPackages © 2026

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