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

ActiveLibrary

bera/bera-router
================

A simple php router

v2.0.1(8mo ago)29311MITPHP

Since May 3Pushed 8mo ago1 watchersCompare

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

READMEChangelog (7)Dependencies (1)Versions (9)Used By (1)

Bera Router
===========

[](#bera-router)

A simple php router

Authors
-------

[](#authors)

- [@joykumarbera](https://www.github.com/joykumarbera)

Features
--------

[](#features)

- Simple Interface
- Support for GET, POST, OPTIONS methods
- Custom 404 page support

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

[](#installation)

Install by using composer

```
  composer require bera/bera-router
```

Usage
-----

[](#usage)

### Quick start

[](#quick-start)

Default controller and middleware namespace is set to `\app\controllers` and `\app\middlewares` which can be set when instantiating the main router object

```
require_once __DIR__  . '/vendor/autoload.php';

$router = new \bera\router\Router();

$router->get('/', function($id) {
    echo 'welcome to index page';
});

$router->post('/post/create', function(\Symfony\Component\HttpFoundation\Request $request, \Symfony\Component\HttpFoundation\Response $response) {
    // add new post here
});

$router->dispatch();
```

### Using middleware

[](#using-middleware)

Setup up the controller and middleware namespace

```
$router = new \bera\router\Router('\\app\\controllers\\', '\\app\\middlewares\\');

$router->get('/admin/blogs', 'TestController@edit', [
  'before' => ['AuthFilterMiddleware']
]);
```

### Using params in route

[](#using-params-in-route)

```
$router->get('/blog/{id}/edit', 'BlogController@edit');
```

Then inside controller we can access the id like this

```
namespace app\controllers;

class BlogController
{
  public function edit($blog_id)
  {
    // edit blog here
  }
}
```

### Route groups

[](#route-groups)

```
$router->group('/admin', [
    'namespace' => '\\app\\controllers\\admin\\',
    'middlewares' => [
        'before' => [
            'AuthFilterMiddleware'
        ],
        'after' => [

        ]
    ]
], function($router) {
    $router->get('/auth/login', 'AuthController@login');
    $router->post('/auth/logout', 'Auth@logout');
});
```

### Setup 404 page route handler

[](#setup-404-page-route-handler)

```
$router = new \bera\router\Router();
$router->set404Route('SomeController@handle404');
```

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance62

Regular maintenance activity

Popularity13

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 92.9% 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 ~144 days

Recently: every ~212 days

Total

7

Last Release

242d ago

Major Versions

v1.1.1 → v2.0.02025-08-29

### Community

Maintainers

![](https://www.gravatar.com/avatar/83c1f3f5cf258ade50e6452be4f3108dc06bac26c222904b640e70e1e1c5c83e?d=identicon)[bera.dev.007](/maintainers/bera.dev.007)

---

Top Contributors

[![joykumarbera](https://avatars.githubusercontent.com/u/47684470?v=4)](https://github.com/joykumarbera "joykumarbera (13 commits)")[![Ayesadesuntech](https://avatars.githubusercontent.com/u/145965424?v=4)](https://github.com/Ayesadesuntech "Ayesadesuntech (1 commits)")

### Embed Badge

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

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

###  Alternatives

[symfony/security-bundle

Provides a tight integration of the Security component into the Symfony full-stack framework

2.5k172.9M1.8k](/packages/symfony-security-bundle)[statamic/cms

The Statamic CMS Core Package

4.8k3.2M720](/packages/statamic-cms)[laravel/reverb

Laravel Reverb provides a real-time WebSocket communication backend for Laravel applications.

1.5k9.4M48](/packages/laravel-reverb)[elgg/elgg

Elgg is an award-winning social networking engine, delivering the building blocks that enable businesses, schools, universities and associations to create their own fully-featured social networks and applications.

1.7k15.7k5](/packages/elgg-elgg)[api-platform/http-cache

API Platform HttpCache component

223.2M7](/packages/api-platform-http-cache)[mapado/rest-client-sdk

Rest Client SDK for hydra API

1125.9k2](/packages/mapado-rest-client-sdk)

PHPackages © 2026

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