mahmud/maintenance-mode 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

mahmud/maintenance-mode

Composer 安装命令:

composer require mahmud/maintenance-mode

包简介

Put your application down and browse in dev mode.

README 文档

README

Build Status Packagist Version Downloads License

Put your application down and browse in dev mode.

Screenshot

Installation

  1. Install package through composer
composer require mahmud/maintenance-mode

Or add dependency to composer.json file

{
    "require": {
        "mahmud/maintenance-mode": "^1.0"
    }
}
  1. Add Service Provider to providers array in config/app.php
'providers' =>  [
    \Mahmud\MaintenanceMode\MaintenanceModeServiceProvider::class,
]
  1. Add the following Middleware in middleware array in app/Http/Kernel.php
protected $middleware = [
    \Mahmud\MaintenanceMode\Middleware\MaintenanceModeMiddleware::class,
];
  1. Publish resources by this command
php artisan vendor:publish --tag=maintenance-mode --force
  1. Add APP_STATUS and UP_TIME to your .env file
APP_STATUS=down
UP_TIME='2017-05-19 23:30:15'

Usage

.env

Set APP_STATUS in your .env file. Possible values are up and down. Set app status to down when you want to go for maintenance. And Also set UP_TIME when your application will be up. UP_TIME format is 'YYYY-MM-DD hh:mm:ss'.

UP_TIME has no effect when APP_STATUS=up

Dev Mode

You can access you app when it is in maintenance mode. To access you must visit your site with query param mode=dev The URL will be

http://your-site.com?mode=dev

Once you browse like this you can browse for the next few minutes specified in cookie_exp_min

Configuration

To change configuration go to config/maintenance-mode.php. Available configurations are listed below.

app_status

This is the status of your app. Possible value are: down | up . When you start maintenance work, you should set the status to down. You can also set the status from .env file. Just set APP_STATUS=down in your environment.

up_time

You should set time when your application will be up. You can set up time from .env file by setting UP_TIME='YYYY-MM-DD hh:mm:ss' in this format.

cookie_exp_min

Dev mode will be expired after specified minutes. After being expired user should visit the site with mode=dev query param to start dev session again.

down_status_code

This status code will be send with the header when you app is down.

app_down_msg

This message will be sent as a response when client sent AJAX request to the app. Response will be in JSON format where key is error and value is the message. For example:

[
    'error' =>  'Application is down for maintenance'
]

view

This view is returned when your application is down. You can set a custom view by specifying the view path here. i.e.

[
    'view'  =>  'public.errors.custom_view'
]

when you view path is resources/views/public/errors.custom_view.blade.php

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-05-22

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固