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

ActiveLibrary[Localization &amp; i18n](/categories/localization)

yii2-extensions/localeurls
==========================

Automatic locale/language management for URLs.

0.1.2(10mo ago)36.6k↓50%BSD-3-ClausePHPPHP &gt;=8.1CI passing

Since Jun 20Pushed 7mo ago1 watchersCompare

[ Source](https://github.com/yii2-extensions/localeurls)[ Packagist](https://packagist.org/packages/yii2-extensions/localeurls)[ GitHub Sponsors](https://github.com/terabytesoftw)[ RSS](/packages/yii2-extensions-localeurls/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (9)Versions (4)Used By (0)

 [ ![Yii Framework](https://camo.githubusercontent.com/cc75562bca6e54e98046e4fb187ef8d96c997a8f31c6f4d2f6ed0c816413b47a/68747470733a2f2f7777772e7969696672616d65776f726b2e636f6d2f696d6167652f7969695f6c6f676f5f6c696768742e737667) ](https://github.com/yii2-extensions/localeurls)

Locale URLs
===========

[](#locale-urls)

 [ ![PHP Version](https://camo.githubusercontent.com/cfe9179013aaeb962182231f5cc56946d96d3c7356e64008b58bad1025cfb1e9/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d253345253344382e312d373837434235) ](https://www.php.net/releases/8.1/en.php) [ ![Yii2 2.0.53](https://camo.githubusercontent.com/9bdad4afe6fd65cdc950a7a86964e9f82ccb4aa29f143a7adaf383f9c229fe21/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f596969322532302d322e302e35332d626c7565) ](https://github.com/yiisoft/yii2/tree/2.0.53) [ ![Yii2 22.0](https://camo.githubusercontent.com/cc30a4e0ee2dcbbd79a3bc946094e14710f904edc3237d1573fb63eac094d588/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f596969322532302d32322d626c7565) ](https://github.com/yiisoft/yii2/tree/22.0) [ ![PHPUnit](https://github.com/yii2-extensions/localeurls/actions/workflows/build.yml/badge.svg) ](https://github.com/yii2-extensions/localeurls/actions/workflows/build.yml) [ ![Mutation Testing](https://camo.githubusercontent.com/1c27d652759552c4d90c89849e50ced95428ed5a5474d49f9bbd5a0261334ec0/68747470733a2f2f696d672e736869656c64732e696f2f656e64706f696e743f7374796c653d666c61742675726c3d687474707325334125324625324662616467652d6170692e737472796b65722d6d757461746f722e696f2532466769746875622e636f6d253246796969322d657874656e73696f6e732532466c6f63616c6575726c732532466d61696e) ](https://dashboard.stryker-mutator.io/reports/github.com/yii2-extensions/localeurls/main) [ ![Static Analysis](https://github.com/yii2-extensions/localeurls/actions/workflows/static.yml/badge.svg) ](https://github.com/yii2-extensions/localeurls/actions/workflows/static.yml)

A powerful URL manager extension that provides transparent language detection, persistence, and locale-aware URL generation for Yii applications.

Create SEO-friendly multilingual URLs with automatic language switching, GeoIP detection, and comprehensive fallback mechanisms.

Features
--------

[](#features)

- ✅ **Automatic Language Detection** - From URL, browser headers, session, or GeoIP.
- ✅ **Flexible Configuration** - Supports language aliases, wildcards, and custom mappings.
- ✅ **Language Persistence** - Remembers user's language choice.
- ✅ **SEO-Friendly URLs** - Clean URLs like `/en/about` or `/es/acerca`.

Quick start
-----------

[](#quick-start)

### Installation

[](#installation)

```
composer require yii2-extensions/localeurls
```

### How it works

[](#how-it-works)

1. **Detects language** from URL path (`/es/about` → Spanish).
2. **Falls back** to browser headers, session, or GeoIP.
3. **Adds language prefix** to all generated URLs.
4. **Remember choice** in session and cookie.

### Basic Configuration

[](#basic-configuration)

Replace your `urlManager` component in `config/web.php`.

```
