PHPackages                             mmaturax/yii2-localeurls - 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. mmaturax/yii2-localeurls

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

mmaturax/yii2-localeurls
========================

Automatic locale/language management for URLs..

1.7.0(8y ago)020MITPHP

Since Oct 15Pushed 7y ago1 watchersCompare

[ Source](https://github.com/MMaturax/yii2-localeurls)[ Packagist](https://packagist.org/packages/mmaturax/yii2-localeurls)[ RSS](/packages/mmaturax-yii2-localeurls/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (1)Versions (39)Used By (0)

Yii2 Locale URLs
================

[](#yii2-locale-urls)

[![Build Status](https://camo.githubusercontent.com/08b982dc1be3ab748a5f41859069266787c4b58ce821545cea93607626c6178f/68747470733a2f2f7365637572652e7472617669732d63692e6f72672f636f64656d69782f796969322d6c6f63616c6575726c732e706e67)](http://travis-ci.org/codemix/yii2-localeurls)[![Latest Stable Version](https://camo.githubusercontent.com/442f07cf405b826d7f2598d48179124bb000760c74fd16622acf46950bc89438/68747470733a2f2f706f7365722e707567782e6f72672f636f64656d69782f796969322d6c6f63616c6575726c732f762f737461626c652e737667)](https://packagist.org/packages/codemix/yii2-localeurls)[![Total Downloads](https://camo.githubusercontent.com/7402b62f1cc6cd84640c3a61c5387ea10014853ca5a37c8c6ec41abe7487bbd7/68747470733a2f2f706f7365722e707567782e6f72672f636f64656d69782f796969322d6c6f63616c6575726c732f646f776e6c6f616473)](https://packagist.org/packages/codemix/yii2-localeurls)[![Latest Unstable Version](https://camo.githubusercontent.com/3b0945f2e5d4779e3e2b5e02c243b3a385f3d9fcea62e7066d5d8cee843cbd6c/68747470733a2f2f706f7365722e707567782e6f72672f636f64656d69782f796969322d6c6f63616c6575726c732f762f756e737461626c652e737667)](https://packagist.org/packages/codemix/yii2-localeurls)[![License](https://camo.githubusercontent.com/bfb696dd3315443cb105fd25fbc68a7994b6e91822535730b5dc7ddf673e6b64/68747470733a2f2f706f7365722e707567782e6f72672f636f64656d69782f796969322d6c6f63616c6575726c732f6c6963656e73652e737667)](https://packagist.org/packages/codemix/yii2-localeurls)

Automatic locale/language management through URLs for Yii 2.

> **IMPORTANT:** If you upgraded from version 1.0.\* you have to modify your configuration. Please check the section on [Upgrading](#upgrading) below.

Features
--------

[](#features)

With this extension you can use URLs that contain a language code like:

```
/en/some/page
/de/some/page
http://www.example.com/en/some/page
http://www.example.com/de/some/page

```

You can also configure friendly names if you want:

```
http://www.example.com/english/some/page
http://www.example.com/deutsch/some/page

```

The language code is automatically added whenever you create a URL, and read back when a URL is parsed. For best user experience the language is autodetected from the browser settings, if no language is used in the URL. The user can still access other languages, though, simply by calling a URL with another language code.

The last requested language is also persisted in the user session and in a cookie. So if the user tries to access your site without a language code in the URL, he'll get redirected to the language he had used on his last visit.

All the above (and more) is configurable of course.

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

[](#installation)

Install the package through [composer](http://getcomposer.org):

```
composer require codemix/yii2-localeurls

```

And then add this to your application configuration:

```
