PHPackages                             infoweb-internet-solutions/yii2-cms-alias - 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. infoweb-internet-solutions/yii2-cms-alias

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

infoweb-internet-solutions/yii2-cms-alias
=========================================

Alias module for Yii2

2.0.4(10y ago)07373[2 issues](https://github.com/infoweb-internet-solutions/yii2-cms-alias/issues)1MITPHP

Since Oct 11Pushed 9y ago3 watchersCompare

[ Source](https://github.com/infoweb-internet-solutions/yii2-cms-alias)[ Packagist](https://packagist.org/packages/infoweb-internet-solutions/yii2-cms-alias)[ RSS](/packages/infoweb-internet-solutions-yii2-cms-alias/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (3)Versions (10)Used By (1)

Alias module for Yii 2
======================

[](#alias-module-for-yii-2)

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

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
php composer.phar require infoweb-internet-solutions/yii2-cms-alias "*"

```

or add

```
"infoweb-internet-solutions/yii2-cms-alias": "*"

```

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

Usage
-----

[](#usage)

Once the extension is installed, simply modify your application configuration as follows:

Your backend configuration as follows:

```
'modules' => [
    ...
    'alias' => [
        'class' => 'infoweb\alias\Module',
        'reservedUrls' => ['page'] // Url's that are reserved by the application
    ],
],
```

Import the translations and use category 'infoweb/alias':

```
yii i18n/import @infoweb/alias/messages

```

To use the module, execute yii migration

```
yii migrate/up --migrationPath=@vendor/infoweb-internet-solutions/yii2-cms-alias/migrations

```

Behavior
--------

[](#behavior)

The `AliasBehavior` is used to manage the `url` field for the entity that the `Alias` is attached to. The behavior has to be attached to an `ActiveRecord` class that has a language identifier. Below is an example of how it can be attached to `\infoweb\pages\models\Lang`

```
use infoweb\alias\behaviors\AliasBehavior;

public function behaviors()
{
    return [
        'alias' => [
            'class' => AliasBehavior::className(),
            'entityType' => Page::className(),
            'entityIdField' => 'page_id'
        ],
    ];
}
```

The `url` field can be rendered in your `ActiveForm` view

```
 // Initialize the tabs

```

If you want to automatically generate the alias based on the content of another field add this to its configuration:

```
'data-slugable' => 'true',
'data-slug-target' => "#alias-{$model->language}-url"
```

Trait
-----

[](#trait)

The `AliasRelationTrait` is used to extend the entity for which you want to enable the usage of `Alias`. It defines custom event(s), the`getAlias` relation for the model and the `findByAlias` method. Below is an example of how it can be attached to `infoweb\pages\models\Page`

```
use infoweb\alias\traits\AliasRelationTrait;

class Page extends ActiveRecord
{
	use AliasRelationTrait;
}
```

You should also add a `getUrl` method to the entity (or modify it if it already exists) that uses the `url` field of the `getAlias` relation.

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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

Recently: every ~5 days

Total

9

Last Release

3722d ago

Major Versions

1.0.3 → 2.0.02016-02-10

### Community

Maintainers

![](https://www.gravatar.com/avatar/7a977fc12b7f6eba9255863c5d9512e400457c69dd67a4b1df82dbc38908768d?d=identicon)[infoweb-internet-solutions](/maintainers/infoweb-internet-solutions)

---

Top Contributors

[![infoweb-internet-solutions](https://avatars.githubusercontent.com/u/8706156?v=4)](https://github.com/infoweb-internet-solutions "infoweb-internet-solutions (17 commits)")[![fabiomaggio](https://avatars.githubusercontent.com/u/729877?v=4)](https://github.com/fabiomaggio "fabiomaggio (13 commits)")[![rubenheymans](https://avatars.githubusercontent.com/u/2543870?v=4)](https://github.com/rubenheymans "rubenheymans (13 commits)")[![kurt0015](https://avatars.githubusercontent.com/u/2662926?v=4)](https://github.com/kurt0015 "kurt0015 (2 commits)")

---

Tags

yii2aliasinfowebyii2-cms-alias

### Embed Badge

![Health badge](/badges/infoweb-internet-solutions-yii2-cms-alias/health.svg)

```
[![Health](https://phpackages.com/badges/infoweb-internet-solutions-yii2-cms-alias/health.svg)](https://phpackages.com/packages/infoweb-internet-solutions-yii2-cms-alias)
```

###  Alternatives

[dmstr/yii2-cookie-consent

Yii2 Cookie Consent Widget

1452.6k](/packages/dmstr-yii2-cookie-consent)[infoweb-internet-solutions/yii2-cms-analytics

Analytics module for Yii2

112.4k1](/packages/infoweb-internet-solutions-yii2-cms-analytics)

PHPackages © 2026

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