yiiplus/yii2-app-devhosts

This package is not installable via Composer 1.x, please make sure you upgrade to Composer 2+. Read more about our Composer 1.x deprecation policy.

使用yii2封装 app devhosts 扩展

Installs: 0

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 4

Forks: 1

Open Issues: 0

Type:yii2-extension

1.0.5 2019-01-30 07:34 UTC

README

使用yii2封装的 app devhosts 扩展,提供了灵活可编辑的 app hosts 数据。主要应用于app中环境的切换,比如从生产切换到测试,它能更加安全和敏捷的提供环境的host数据。

1.安装

安装此扩展程序的首选方法是通过 composer.

编辑运行

php composer.phar require --prefer-dist yiiplus/yii2-app-devhosts "^1.0.0"

或添加配置到项目目录下的composer.json文件的require部分

"yiiplus/yii2-app-devhosts": "^1.0.0"

2.配置

配置后台对数据的增删改查模块

'modules' => [
    ...
    'app-devhosts' => [
        'class' => 'yiiplus\appDevhosts\Module',
    ],
    ...
],

'components' => [
    ...
    'i18n' => [
        'translations' => [
            '*' => [
                'class' => 'yii\i18n\PhpMessageSource'
            ],
        ],
    ],
    ...
]

3.创建数据库

./yii migrate --migrationPath=@yiiplus/appDevhosts/migrations

4.使用

定义app访问接口

//Controller
Class AppDevhostsController extends Controller
{
    function actions(){
       return [
            ...
            'index' => [
            	'class' => 'yiiplus\appDevhosts\actions\ApiActions'
            ],
            ...
        ];
    }
}
  • 如需操作数据,则访问后台页面:xxx.com/app-devhosts
  • app接口地址:xxx.com/xxx/app-devhosts?token=xxx