mhunesi/yii2-csc
最新稳定版本:v1.0.2
Composer 安装命令:
composer require mhunesi/yii2-csc
包简介
Yii2 Country State City migration and models.
README 文档
README
Yii2 Country State City migration and models.
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist mhunesi/yii2-csc "*"
or add
"mhunesi/yii2-csc": "*"
to the require section of your composer.json file.
Usage
Once the extension is installed, simply use it in your code by :
And run migration:
'controllerMap' => [ 'migrate' => [ //.. 'migrationNamespaces' => [ //.. ], 'migrationPath' => [ //.. '@mhunesi/csc/migrations' ] ] ],
php yii migrate
OR
yii migrate --migrationPath=@mhunesi/csc/migrations
Models
- Country
- State
- City
use mhunesi\csc\models\Country; use mhunesi\csc\models\State; use mhunesi\csc\models\City; //Example 1 /** @var Country[] $country */ $country = Country::find()->all(); /** @var State[] $states */ $states = $country->states; foreach ($states as $state) { /** @var City[] $cities */ $cities = $state->cities } //Example 2 Country::find()->where(['iso2' => 'TR'])->one(); State::find()->where(['country_code' => 'TR'])->all();
统计信息
- 总下载量: 23
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-12-02