Git Product home page Git Product logo

yii2-maintenance-mode's Introduction

#Yii2 Maintenance mode component Latest Stable Version Total Downloads License ##Install Either run

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

or add

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

to the require section of your composer.json file.

Add to your config file:

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

##Options

'maintenanceMode'=>[

  // Component class namespace
  'class' => '\brussens\maintenance\MaintenanceMode',
  
  // 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'=>[
    'BrusSENS',
  ],
  
  // 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,
  
],

##Set maintenance mode by console command

Add to your console config file:

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

Change your web config file:

  
    'maintenanceMode'=>[
    
      'class' => '\brussens\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'
    ]

yii2-maintenance-mode's People

Contributors

marcuzzz avatar stefandoorn avatar filipe1309 avatar mike-kramer avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.