2017 © Pedro Peláez
 

yii2-extension yii2-language-url-manager

Extension to manage languages in urls

image

metalguardian/yii2-language-url-manager

Extension to manage languages in urls

  • Friday, November 6, 2015
  • by MetalGuardian
  • Repository
  • 3 Watchers
  • 4 Stars
  • 254 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 3 Forks
  • 0 Open issues
  • 1 Versions
  • 21 % Grown

The README.md

Yii2 language url manager

Extension manage urls with language in it, (*1)

Latest Stable Version Total Downloads Latest Unstable Version License, (*2)

Code Status

Scrutinizer Code Quality Build Status Code Coverage Code Climate, (*3)

Installation

The preferred way to install this extension is through composer., (*4)

Either run, (*5)

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

or add, (*6)

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

to the require section of your composer.json file., (*7)

Usage

Once the extension is installed, simply use it in your config by :, (*8)

    '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., (*9)

Strongly recommended to set UrlManager::enableStrictParsing in true, (*10)

The Versions

06/11 2015

dev-master

9999999-dev

Extension to manage languages in urls

  Sources   Download

MIT

The Requires

 

by Ivan Pushkin

language url extension yii2