PHPackages                             pheme/yii2-i18n-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. [Localization &amp; i18n](/categories/localization)
4. /
5. pheme/yii2-i18n-url

ActiveYii2-extension[Localization &amp; i18n](/categories/localization)

pheme/yii2-i18n-url
===================

Internationalize your urls

144.2k7[1 PRs](https://github.com/phemellc/yii2-i18n-url/pulls)PHP

Since Jan 18Pushed 6y ago5 watchersCompare

[ Source](https://github.com/phemellc/yii2-i18n-url)[ Packagist](https://packagist.org/packages/pheme/yii2-i18n-url)[ RSS](/packages/pheme-yii2-i18n-url/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

Yii2 i18n URL Manager
=====================

[](#yii2-i18n-url-manager)

Internationalize your urls

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

[](#installation)

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

Either run

```
php composer.phar require --prefer-dist pheme/yii2-i18n-url "dev-master"

```

or add

```
"pheme/yii2-i18n-url": "dev-master"

```

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

Usage
-----

[](#usage)

In your configuration file, add or replace your UrlManager component:

```
'components' => [
	'urlManager' => [
		'class' => 'pheme\i18n\I18nUrlManager',
		//'displaySourceLanguage' => true,
		//'rewriteBaseUrl' => true,
		//'languageParam' => 'lang',
		'languages' => ['en', 'gr'],
		'aliases' => [],
		// 'aliases' => ['en' => 'en-US', 'sr' => 'sr-Latn'],
		// The keys will become labels on the language switcher widget
		// 'languages' => ['English' => 'en', 'Ελληνικά' => 'gr']
		'enablePrettyUrl' => true,
		'showScriptName' => false,
		'rules' => [],
	],
	...
]
```

Example of changing the language

```
