PHPackages                             karakum/yii2-region-reference - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. karakum/yii2-region-reference

ActiveYii2-extension[Utility &amp; Helpers](/categories/utility)

karakum/yii2-region-reference
=============================

This extension provides a region reference module

1.0.1(9y ago)2233MITPHP

Since Oct 27Pushed 9y ago1 watchersCompare

[ Source](https://github.com/karakum/yii2-region-reference)[ Packagist](https://packagist.org/packages/karakum/yii2-region-reference)[ Docs](https://github.com/karakum/yii2-region-reference)[ RSS](/packages/karakum-yii2-region-reference/feed)WikiDiscussions master Synced today

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

Region reference Yii2 module
============================

[](#region-reference-yii2-module)

This extension provide a region reference module(backend &amp; frontend) with feature: backend:

- Customizable regions structure(country-region-city...)
- Mass region creation
- Import/export whole country structure
- Two backend module theme: default yii2 &amp; AdminLTE
- Auto generate region structure example data(while install migration), optional

frontend &amp; backend:

- Ajax controller for search regions. Applicable for Select2 field for select region.

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

[](#installation)

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

Either run

```
php composer.phar require --prefer-dist karakum/yii2-region-reference "*"

```

or add

```
"karakum/yii2-region-reference": "*"

```

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

Configuration
-------------

[](#configuration)

In application config add:

```
    'modules' => [
    	...
        'regions' => [
            'class' => 'karakum\region\BackendModule',
        ],
    	...
    ],
    'components' => [
    	...
        'regionManager' => [
            'class' => 'karakum\region\RegionManager',
        ],
    	...
    ],

```

For frontend application you can use `karakum\region\FrontendModule`, it provide only ajax controller with unauthorized access. `karakum\region\BackendModule` already include ajax controller.

Default country. If you want to use only one country in your application, you can set `country` property in region manager(default is `false`) with country code. For example, if you set `RU` then it will change some behavior of manager's functions: function `getRegionFullname` will omit country name in output and ajax output will contain only regions in selected country and country record excluded.

Migrations
----------

[](#migrations)

Before applying migration you can set `exampleData` property to `true`(by default it is `false`) for `regionManager` component for generate some example data. If you do that then migration will create:

- region types. Default: COUNTRY, REGION, CITY. It depends on region manager property `defaultTypes`.
- region levels. Default: Country, Region in Country, City in Region in Country, City in Country. It depends on region manager property `defaultLevels`.

Migration will create tables with default names `{{%region}}`, `{{%region_level}}`, `{{%region_type}}`. To change it use properties `regionTypeTable`, `regionLevelTable`, `regionTable` of region manager component.

To apply migration you can add `@karakum/region/migrations` to migrations lookup list(if you use extension like `cyberz/yii2-multipath-migrations`) or run:

```
$ yii migrate --migrationPath=@karakum/region/migrations

```

Theme select
------------

[](#theme-select)

Backend module provided with two predefined themes. By default it use standard Yii2 theme. If you prefer AdminLTE template and use extension `dmstr/yii2-adminlte-asset`, you can use predefined AdminLTE theme:

```
    'components' => [
	    ...
        'view' => [
            'theme' => [
                'pathMap' => [
                    '@karakum/region/views' => '@karakum/region/themes/adminlte/views',
                ],
            ],
        ],
	    ...
    ],

```

Both themes use module predefined layouts. To use your own layout just set `layout` to `null` in module config:

```
    'modules' => [
        'regions' => [
            'class' => 'karakum\region\BackendModule',
            'layout' => null,
        ],
    ],

```

Usage
-----

[](#usage)

Example of usage kartik-v Select2 for autocomplete selecting region

```

```

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

3533d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7f26f51b2f88ac853b2653bca64c0966abcda29443af2345a1d2b8ac96cadc3d?d=identicon)[karakum](/maintainers/karakum)

---

Top Contributors

[![karakum](https://avatars.githubusercontent.com/u/12033941?v=4)](https://github.com/karakum "karakum (3 commits)")

---

Tags

yii2extensionmoduleReferenceregion

### Embed Badge

![Health badge](/badges/karakum-yii2-region-reference/health.svg)

```
[![Health](https://phpackages.com/badges/karakum-yii2-region-reference/health.svg)](https://phpackages.com/packages/karakum-yii2-region-reference)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
