PHP code example of echotrue / yii2-area

1. Go to this page and download the library: Download echotrue/yii2-area library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

echotrue / yii2-area example snippets


    Controller :
    public function actions()
     {
         return [
             'area'    => [
                 'class' => 'echotrue\area\AreaAction',
                 'tableName' => 'china_area',
             ]
         ];
     }
     View:
    echo \echotrue\area\Area::widget([
        'name'    => 'name',
        'options' => [
            'tableName' => 'china_area',
            'url'       => \yii\helpers\Url::to(['site/area'])
        ]
    ]);


 Controller :
 public function actions()
     {
         return [
             'area'    => [
                 'class' => 'echotrue\area\AreaAction',
                 'tableName' => 'china_area',
             ]
         ];
     }
            
 View:           
 <?= $form->field($model,'name')->widget(\echotrue\area\Area::className(), [
        'model'     => $model,
        'options'   => [
            'tableName' => 'china_area',
            'url'       => \yii\helpers\Url::to(['site/area'])
        ]
    ])