承接 malsa/yii2-maintenance-mode 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

malsa/yii2-maintenance-mode

最新稳定版本:0.2.10

Composer 安装命令:

composer require malsa/yii2-maintenance-mode

包简介

Maintenance mode component for Yii framework 2.x.x version.

README 文档

README

Install

Either run

php composer.phar require --prefer-dist malsa/yii2-maintenance-mode "*"

or add

"malsa/yii2-maintenance-mode": "*"

to the require section of your composer.json file.

Add to your config file:

'bootstrap' => ['log', 'maintenanceMode'],
...
'components' => [
    'maintenanceMode' => [
        'class' => 'malsa\maintenance\MaintenanceMode',
    ],
    ...
],

Options

'maintenanceMode' => [
    // Component class namespace
    'class' => 'malsa\maintenance\MaintenanceMode',

    // Page title
    'title' => 'Custom title',

    // Mode status
    'enabled' => true,

    // Route to action
    'route' => 'maintenance/index',

    // Show title
    'title' => 'this site is under maintenance',

    // Show message
    'message' => 'Sorry, perform technical works.',

    // Allowed user names
    'users' => [
        'Malsa',
    ],

    // Allowed roles
    'roles' => [
        'administrator',
    ],

    // Allowed IP addresses
    'ips' => [
        '127.0.0.1',
    ],

    // Allowed URLs
    'urls' => [
        'site/login'
    ],

    // Layout path
    'layoutPath' => '@web/maintenance/layout',

    // View path
    'viewPath' => '@web/maintenance/view',

    // User name attribute name
    'usernameAttribute' => 'login',

    // HTTP Status Code
    'statusCode' => 503,

    //Retry-After header
    'retryAfter' => 120 //or Wed, 21 Oct 2015 07:28:00 GMT for example
],

Set maintenance mode by console command

Add to your console config file:

'bootstrap' => ['log', 'maintenanceMode'],
...
'components' => [
    'maintenanceMode' => [
        'class' => 'malsa\maintenance\MaintenanceMode',
    ],
...
],

Change your web config file:

'maintenanceMode' => [
    'class' => 'malsa\maintenance\MaintenanceMode',
    'enabled' => false
],

Now you can set mod by command:

php yii maintenance/enable
php yii maintenance/disable

Allow display debug panel

Add the following rules in the 'urls' section of component settings:

'urls' => [
    'debug/default/toolbar',
    'debug/default/view'
]

Switch mode in dashboard

class DashboardController extends Controller
{
    ...
    public function actionEnable()
    {
        ...
        Yii::$app->maintenance->enable();
        ...
    }
    public function actionDisable()
    {
        ...
        Yii::$app->maintenance->disable();
        ...
    }
    ...
}

统计信息

  • 总下载量: 8.06k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 32
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-04-08

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固