This is an Yii2 widget for Chinese region list field. (https://github.com/rowe/yii2-region)
Add to composer.json file with:
"rowe/yii2-region": "dev-master"
Copy the @rowe/yii2-region/src/migrations/m170621_032947_region.php to the migration folder like console/migrations. Run
"Yii migrate"
The region codes would be inserted via Yii migration
Firstly, bind the behavior to your model which need to use the region fields.
public function behaviors()
{
return [
'RegionBehavior' => [
'class' => RegionBehavior::className(),
]
];
}
And then, use the widget in the view.
<?= RegionWidget::widget(['model' => $model]);?>