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

ActiveLibrary[Framework](/categories/framework)

gevman/yii2-router
==================

Elegant Route definitions for Yii2

1.1.6(7y ago)504.9k↓50%1MITPHPPHP &gt;=5.4.0

Since Sep 29Pushed 7y ago7 watchersCompare

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

READMEChangelog (10)Dependencies (1)Versions (13)Used By (0)

Yii2 Elegant Route definitions
==============================

[](#yii2-elegant-route-definitions)

Installation (using composer)
-----------------------------

[](#installation-using-composer)

```
composer require gevman/yii2-router
```

##### Add this to `modules` section of Your Yii2 configuration

[](#add-this-to-modules-section-of-your-yii2-configuration)

```
'modules' => [
    //...
    'router' => [
        'class' => 'Gevman\Router\Module',
        'routeFolder' => '@app/config/routes' //directory where located route files
    ]
    //,...
]
```

##### and this to `bootstrap` section

[](#and-this-to-bootstrap-section)

```
'bootstrap' => [
    //...
    'router'
    //,...
],
```

in `routeFolder` directory You need create Your route files.

ex. `web.php` with content

```
$auth = function () {
  if (Yii::$app->user->isGuest) {
      Yii::$app->response->redirect(Url::toRoute(['@login']));
  }
};

Route::prefix('/admin')->routePrefix('admin')->group(function () use ($auth) {
    Route::any('/login', 'default/login')->named('login');

    Route::middleware($auth)->group(function () {
        Route::post('/logout', 'default/logout')->named('logout');

        Route::any('/', 'pages/index')->named('admin.pages');
        Route::any('/pages/create', 'pages/create')->named('admin.pages.create');
        Route::any('/pages//edit/', 'pages/update')->defaults(['lang' => ''])->named('admin.pages.edit');
        Route::post('/pages//delete', 'pages/delete')->named('admin.pages.delete');

        Route::prefix('menu')->routePrefix('menu')->group(function () {
            Route::any('/', 'index')->named('admin.menu.index');
            Route::any('create', 'create')->named('admin.menu.create');
            Route::any('/edit/', 'update')->defaults(['lang' => ''])->named('admin.menu.edit');
            Route::post('/delete', 'delete')->named('admin.menu.delete');
        });

    });
});
```

after You can use Yii2 native methods for url creation

ex.

```
echo \yii\helpers\Url::toRoute(['@admin.menu.edit', 'id' => 1, 'lang' => 'hy']);
```

output will be: `/admin/menu/1/edit/hy`

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity33

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity65

Established project with proven stability

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

Recently: every ~13 days

Total

12

Last Release

2816d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/11891855?v=4)[Gevorg Mansuryan](/maintainers/gevorgmansuryan)[@gevorgmansuryan](https://github.com/gevorgmansuryan)

---

Top Contributors

[![gevorgmansuryan](https://avatars.githubusercontent.com/u/11891855?v=4)](https://github.com/gevorgmansuryan "gevorgmansuryan (20 commits)")

---

Tags

laravelrouteryii2yiilaravel-routerLaravel RoutingYii2 RouterYii2 Routing

### Embed Badge

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

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

###  Alternatives

[dragon-code/support

Support package is a collection of helpers and tools for any project.

238.7M101](/packages/dragon-code-support)

PHPackages © 2026

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