PHPackages                             maks757/yii2-friendly-url - 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. maks757/yii2-friendly-url

ActiveYii2-extension

maks757/yii2-friendly-url
=========================

Friendly url for your library or module

v1.0.0(8y ago)0339↓100%1BSD-4-ClausePHP

Since Apr 9Pushed 8y ago1 watchersCompare

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

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

Friendly url
============

[](#friendly-url)

Friendly url for your library or module

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

[](#installation)

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

Either run

```
php composer.phar require --prefer-dist maks757/yii2-friendly-url "*"

```

or add

```
"maks757/yii2-friendly-url": "*"

```

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

Usage
-----

[](#usage)

Model
-----

[](#model)

```
// implements IUrlRules !!!
class ProductModel extends \yii\db\ActiveRecord implements maks757\friendly\components\IUrlRules
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'products';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            //...
            // seo data
            [['seoUrl', 'seoTitle', 'seoDescription', 'seoKeywords'], 'string']
        ];
    }

    // Exemple: $key = 'my-first-product' -> return id
    /**
     * @param mixed $key
     * @return boolean|integer model id
     */
    public function fiendKey($key)
    {
        $model = ProductModel::findOne(['seoUrl' => $key]);
        return empty($model) ? false : $model->id;
    }

    // Exemple: $id = 10 -> return seoUrl
    /**
     * @param integer $id
     * @return string
     */
    public function seoUrl($id)
    {
        return ProductModel::findOne($id)->seoUrl;
    }
}
```

Configuration
-------------

[](#configuration)

```
'components' => [
    //...
    'urlManager' => [
        'enablePrettyUrl' => true,
        'showScriptName' => false,
        'rules' => [
            'news' => 'product/show',
            [
                    'class' => \maks757\friendly\UrlRules::className(),
                    'action' => 'product/show', // View 'product/show' or news
                    'controller_and_action' => 'product/show', // Action news show
                    //param: (action_key) - Action param get product id
                    //param: (url_key) - // View set product id
                    'routes' => [
                        ['model' => \common\models\ProductGroupModel::class, 'url_key' => 'group_id', 'action_key' => 'group',],
                        ['model' => \common\models\ProductModel::class, 'url_key' => 'product_id', 'action_key' => 'product',],
                    ]
                ],
        ],
    ],
    //...
],
```

View
----

[](#view)

```
Go to product
```

example url:
water = group seo url
colla = product seo url

Action from Product Controller
------------------------------

[](#action-from-product-controller)

```
public function actionShow($group, $product)
{
    //...
}
```

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity63

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

Unknown

Total

1

Last Release

2956d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/01c371c7fbc2ec621f8d6467fee73103eb461d1082748a2b0ad216ea91f9b355?d=identicon)[maks757](/maintainers/maks757)

---

Top Contributors

[![maks757](https://avatars.githubusercontent.com/u/11841208?v=4)](https://github.com/maks757 "maks757 (26 commits)")

---

Tags

urlyii2extensionfriendlyfriendly url

### Embed Badge

![Health badge](/badges/maks757-yii2-friendly-url/health.svg)

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

###  Alternatives

[skeeks/cms

SkeekS CMS — control panel and tools based on php framework Yii2

13825.6k47](/packages/skeeks-cms)[mg-code/yii2-helpers

A collection of useful helper classes for Yii framework 2.0

2022.5k5](/packages/mg-code-yii2-helpers)[cetver/yii2-languages-dispatcher

Sets the web-application language for the Yii framework 2.0

1029.7k](/packages/cetver-yii2-languages-dispatcher)[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)
