softedge/yii2-countries
Composer 安装命令:
composer require softedge/yii2-countries
包简介
Model and migration to add countries to your yii2 app
README 文档
README
- Introduction
Yii2 Countries --- Multilingual extension for the Yii2 framework, which provides a list of all countries and their demonym, plus a migration file and an AR model.
- Requires
agroxy/yii2-multilingual(Github) - Multilanguage support
- Dependencies
- php >= 7.0
- composer
- MySql >= 5.5
- agroxy/yii2-multilingual
- Installation
Via composer:
composer require "softedge/yii2-countries": "^1.1.0"
or add the following in section require of composer.json:
"require": {
"softedge/yii2-countries": "^1.1.0"
}
and run command composer install,
or command composer update, if all yii2 project extensions are already installed.
- Usage
Main properties
The namespace for classes: slayvin\countries.
Application config
To add the tables to the database, run the provided migration:
'controllerMap' => [ 'migrate' => [ 'class' => yii\console\controllers\MigrateController::class, 'migrationNamespaces' => [ 'slayvin\countries\migrations' ], ] ],
If you need multilingual support, add the languages in your app config params:
... 'languages' => ['en',...] ...
Database tables
Country table "countries"
| iso | selectable | default |
|---|---|---|
| AD | 0 | 0 |
| AE | 0 | 0 |
| ... | ... | ... |
| ZW | 0 | 0 |
Translation table "countries_lang"
| country_iso | language | name | demonym |
|---|---|---|---|
| AD | en | Andorra | Andorran |
| AE | en | United Arab Emirates | Emirati |
| ... | ... | ... | ... |
| ZW | fr | Zimbabwe | Zimbabwéen-ne |
Here, we have:
- non-multilingual fields: iso, selectable, default
- multilingual fields: name, demonym
License
Licensed under the MIT license.
统计信息
- 总下载量: 3
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-10-22