metalguardian/yii2-language-url-manager Extension to manage languages in urls

extensionurllanguage

Yii2 language url manager

Extension manage urls with language in it

Latest Stable Version Total Downloads Latest Unstable Version License

Code Status

Scrutinizer Code Quality Build Status Code Coverage Code Climate

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist metalguardian/yii2-language-url-manager "*"

or add

"metalguardian/yii2-language-url-manager": "*"

to the require section of your composer.json file.

Usage

Once the extension is installed, simply use it in your config by :

    'urlManager' => [
        'class' => '\metalguardian\language\UrlManager',
        'languages' => ['ua' => 'uk', 'en', 'ru'],
        ....
        or 
        'languages' => function () {
            return \app\models\Language::find()->select(['code'])->column();
        },
        ....
        'rules' => [ // rules are required
            '<module>/<controller>/<action>' => '<module>/<controller>/<action>',
            '<controller>/<action>' => '<controller>/<action>',
            '' => 'site/index',
        ],
    ],

You need to specify rules (required). In other way generated links will not be correct.

Strongly recommended to set UrlManager::enableStrictParsing in true

Statistics

Downloads
GitHub Stars
GitHub Forks

Releases

No stable releases.

Comments



No stable releases.



MIT license
Stats
3 github stars & 3 github forks
1 downloads in the last day
4 downloads in the last 30 days
499 total downloads