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

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

dlds/yii2-localeurls
====================

Automatic locale/language management for URLs.

1.1.1(9y ago)03.3kMITPHP

Since Oct 15Pushed 9y ago2 watchersCompare

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

READMEChangelog (7)DependenciesVersions (13)Used By (0)

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

[](#yii2-locale-urls)

Automatic locale/language management through URLs for Yii 2.

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 - but the user can still access other languages 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 dlds/yii2-localeurls

```

And then add this to your application configuration:

```
