softedge/yii2-countries

模型和迁移,为您的yii2应用添加国家信息

安装次数: 3

依赖关系: 0

建议者: 0

安全: 0

星标: 0

关注者: 2

分支: 0

开放问题: 0

类型:yii2-extension

1.1.0 2019-10-22 16:13 UTC

This package is auto-updated.

Last update: 2024-09-23 03:04:39 UTC


README

  1. 介绍

Yii2 Countries --- 为Yii2框架提供的多语言扩展,包含所有国家和它们的名称,还包含迁移文件和AR模型。

  • 需要 agroxy/yii2-multilingual (Github)
  • 多语言支持
  1. 依赖项
  • php >= 7.0
  • composer
  • MySql >= 5.5
  • agroxy/yii2-multilingual
  1. 安装

通过composer

composer require "softedge/yii2-countries": "^1.1.0"

或者在composer.json的require部分添加以下内容

"require": {
    "softedge/yii2-countries": "^1.1.0"
}

然后运行命令 composer install,

或者命令 composer update,如果所有yii2项目扩展已经安装。

  1. 使用方法

主要属性

类的 命名空间slayvin\countries

应用程序配置

要向数据库添加表,请运行提供的迁移

'controllerMap' => [
        'migrate' => [
            'class' => yii\console\controllers\MigrateController::class,
            'migrationNamespaces' => [
                'slayvin\countries\migrations'
            ],
        ]
    ],

如果您需要多语言支持,请将语言添加到您的应用程序配置参数中

...
'languages' => ['en',...]
...

数据库表

国家表 "countries"

翻译表 "countries_lang"

这里,我们有

  • 非多语言字段:isoselectabledefault
  • 多语言字段:namedemonym

许可证

根据 MIT许可证 许可。