2017 © Pedro Peláez
 

yii2-extension yii2-maintenance-mode

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

image

malsa/yii2-maintenance-mode

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

  • Monday, April 9, 2018
  • by MattRh
  • Repository
  • 1 Watchers
  • 0 Stars
  • 18 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 20 Forks
  • 0 Open issues
  • 11 Versions
  • 100 % Grown

The README.md

Yii2 Maintenance mode component

Install

Either run, (*1)

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

or add, (*2)

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

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

Add to your config file:, (*4)

'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:, (*5)

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

Change your web config file:, (*6)

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

Now you can set mod by command:, (*7)

php yii maintenance/enable

``` php yii maintenance/disable, (*8)

## Allow display debug panel

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

```php
'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();
        ...
    }
    ...
}

The Versions

09/04 2018

dev-master

9999999-dev

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

  Sources   Download

MIT

The Requires

 

by Brusenskiy Dmitry
by Malsa

maintenance yii2 yii mode

09/04 2018

0.2.10

0.2.10.0

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

  Sources   Download

MIT

The Requires

 

by Brusenskiy Dmitry
by Malsa

maintenance yii2 yii mode

09/04 2018

0.2.9

0.2.9.0

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

  Sources   Download

MIT

The Requires

 

by Brusenskiy Dmitry
by Malsa

maintenance yii2 yii mode

09/04 2018

0.2.7

0.2.7.0

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

  Sources   Download

MIT

The Requires

 

by Brusenskiy Dmitry
by Malsa

maintenance yii2 yii mode

19/06 2017

0.2.6

0.2.6.0

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

  Sources   Download

MIT

The Requires

 

by Brusenskiy Dmitry

maintenance yii2 yii mode

28/01 2017

0.2.5

0.2.5.0

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

  Sources   Download

MIT

The Requires

 

by Brusenskiy Dmitry
by Poltoratsky Alexander
by ibra1994

maintenance yii2 yii 2 mode

11/01 2017

0.2.4

0.2.4.0

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

  Sources   Download

MIT

The Requires

 

by Brusenskiy Dmitry
by Poltoratsky Alexander
by ibra1994

maintenance yii2 yii 2 mode

13/11 2015

0.2.3

0.2.3.0

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

  Sources   Download

MIT

The Requires

 

by Brusenskiy Dmitry
by Poltoratsky Alexander

maintenance yii2 yii 2 mode

26/10 2015

0.2.2

0.2.2.0

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

  Sources   Download

BSD-3-Clause

The Requires

 

by Brusenskiy Dmitry
by Poltoratsky Alexander

maintenance yii2 yii 2 mode

24/04 2015

v0.2.1

0.2.1.0

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

  Sources   Download

BSD-3-Clause

The Requires

 

by Brusenskiy Dmitry

maintenance yii2 yii 2 mode

09/02 2015

v0.2.0

0.2.0.0

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

  Sources   Download

BSD-3-Clause

The Requires

 

by Brusenskiy Dmitry

maintenance yii2 yii 2 mode