PHPackages                             mg-code/yii2-url-manager - 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. mg-code/yii2-url-manager

ActiveYii2-extension[Utility &amp; Helpers](/categories/utility)

mg-code/yii2-url-manager
========================

Useful url rules for url manager.

1.0.0(9y ago)18.2k↓50%1BSD 3-ClausePHP

Since Jul 22Pushed 9y ago1 watchersCompare

[ Source](https://github.com/mg-code/yii2-url-manager)[ Packagist](https://packagist.org/packages/mg-code/yii2-url-manager)[ Docs](https://github.com/mg-code/yii2-url-manager)[ RSS](/packages/mg-code-yii2-url-manager/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

yii2-url-manager
================

[](#yii2-url-manager)

Useful url rules for url manager.

Install
-------

[](#install)

Either run

```
$ php composer.phar require mg-code/yii2-url-manager "@dev"

```

or add

```
"mg-code/yii2-url-manager": "@dev"

```

to the `require` section of your `composer.json` file.

Usage
-----

[](#usage)

Once the extension is installed, you can use url rules:

#### HostUrlRule

[](#hosturlrule)

Filters url rules by host name. Useful if your application works on multiple domains/subdomains.

```
return [
    'class' => 'yii\web\UrlManager',
    ......
    'rules' => [
       ['class' => 'mgcode\urlManager\HostUrlRule', 'host' => 'payment.example.com', 'rules' => [
            ['pattern' => '/', 'route' => '/payment/default/index'],
        ]],
    ]
];
```

#### RedirectUrlRule

[](#redirecturlrule)

Redirects user to destination route if current request matched. Simply configure as any other url rule. You can specify statusCode, defaults to: 301.

```
return [
    'class' => 'yii\web\UrlManager',
    ......
    'rules' => [
        ['pattern' => '/some-old-link', 'route' => '/new/action', 'class' => 'mgcode\urlManager\RedirectUrlRule'],
    ]
];
```

See [Yii Routing and URL Creation](http://www.yiiframework.com/doc-2.0/guide-runtime-routing.html) for more detail.

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity25

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

3583d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1376496?v=4)[Māris Graudiņš](/maintainers/mg-code)[@mg-code](https://github.com/mg-code)

---

Top Contributors

[![mg-code](https://avatars.githubusercontent.com/u/1376496?v=4)](https://github.com/mg-code "mg-code (9 commits)")[![matrozov](https://avatars.githubusercontent.com/u/4449593?v=4)](https://github.com/matrozov "matrozov (1 commits)")

---

Tags

hostyii2extensionurl managerurl rule

### Embed Badge

![Health badge](/badges/mg-code-yii2-url-manager/health.svg)

```
[![Health](https://phpackages.com/badges/mg-code-yii2-url-manager/health.svg)](https://phpackages.com/packages/mg-code-yii2-url-manager)
```

###  Alternatives

[vyants/yii2-daemon

Extension provides functionality for simple daemons creation and control

7859.0k](/packages/vyants-yii2-daemon)[dmstr/yii2-cookie-consent

Yii2 Cookie Consent Widget

1452.6k](/packages/dmstr-yii2-cookie-consent)[richardfan1126/yii2-js-register

Yii2 widget to register JS into view

1357.2k7](/packages/richardfan1126-yii2-js-register)

PHPackages © 2026

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