2017 © Pedro Peláez
 

yii2-extension yii2-maintenance

Component for maintenance mode behavior, focused on retrieve status from external configuration

image

insolita/yii2-maintenance

Component for maintenance mode behavior, focused on retrieve status from external configuration

  • Tuesday, July 4, 2017
  • by Insolita
  • Repository
  • 2 Watchers
  • 2 Stars
  • 8 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 33 % Grown

The README.md

Custom mantenance component

  • Component for maintenance mode behavior, focused on retrieve status from external configuration
  • Support ability for allow exclusive access in maintenance mode for specified ips
  • Support preliminar notice about soon maintenance works
  • Provide observable events when maintenance process or preliminar modes

Status, (*1)

Installation

The preferred way to install this extension is through composer., (*2)

Either run, (*3)

composer require --prefer-dist insolita/yii2-maintenance "~0.0.1"

or add, (*4)

"insolita/yii2-maintenance": "~0.0.1"

to the require section of your composer.json file., (*5)

Usage

Once the extension is installed, add in config components section, and also bootstrap section :, (*6)

     'bootstrap'=>['log','config','maintenance'],
     'container'=>[
     ...
         'definitions'=>[
             '\insolita\maintenance\IConfig'=>'your\config\component\class'
         ]
     ],
     ...
     'components'=>[
          'maintenance'=>[
              'class'=>'\insolita\maintenance\Maintenance',
              'enabledKey'=>'config key for maintennce indication',
              'preliminarKey'=>'config key for preliminar maintenance indication',
              'ipSkippedKey'=>'config key for comma-seperated ips with exclusive access',
              'catchRoute'=>['site/maintenance'], //- route catched all requests in maintenance mode
              //possible events use cases
              'on maintenance_process'=>function($event){
                  //$event->sender is maintenance component!
                  if($event->sender->isSkipForIp===true){
                     Yii::$app->getSession()->setFlash('warning','Site in maintenance mode!');
                  }
              },
              'on maintenance_soon'=>function($event){
                  Yii::$app->getSession()->setFlash('warning',
                  'After 5 minutes, the site will be serviced, please finish or save the undelivered messages');
               }
          ]
     ],

The Versions

04/07 2017

dev-master

9999999-dev

Component for maintenance mode behavior, focused on retrieve status from external configuration

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar Insolita

extension yii2

01/06 2017

0.0.1

0.0.1.0

...

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar Insolita

extension yii2