PHPackages                             malsa/yii2-maintenance-mode - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. malsa/yii2-maintenance-mode

ActiveYii2-extension[Utility &amp; Helpers](/categories/utility)

malsa/yii2-maintenance-mode
===========================

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

0.2.10(8y ago)08.1kMITPHPPHP &gt;=7.0.0

Since Feb 9Pushed 8y ago1 watchersCompare

[ Source](https://github.com/MattRh/yii2-maintenance-mode)[ Packagist](https://packagist.org/packages/malsa/yii2-maintenance-mode)[ RSS](/packages/malsa-yii2-maintenance-mode/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (4)Dependencies (1)Versions (11)Used By (0)

Yii2 Maintenance mode component
===============================

[](#yii2-maintenance-mode-component)

Install
-------

[](#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
-------

[](#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
---------------------------------------

[](#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
-------------------------

[](#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
------------------------

[](#switch-mode-in-dashboard)

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

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor3

3 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~128 days

Recently: every ~109 days

Total

10

Last Release

3001d ago

PHP version history (3 changes)0.2.5PHP &gt;=5.4.0

0.2.7PHP &gt;=7.1.0

0.2.9PHP &gt;=7.0.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/a9f5b4d0af3244da578fb97344dc04f5badab865cf241c83598dc7b5329259e6?d=identicon)[MattRh](/maintainers/MattRh)

---

Top Contributors

[![malsatin](https://avatars.githubusercontent.com/u/9138285?v=4)](https://github.com/malsatin "malsatin (4 commits)")[![mattrh](https://avatars.githubusercontent.com/u/59623366?v=4)](https://github.com/mattrh "mattrh (2 commits)")[![Ibra1994](https://avatars.githubusercontent.com/u/15104029?v=4)](https://github.com/Ibra1994 "Ibra1994 (1 commits)")[![Marcuzzz](https://avatars.githubusercontent.com/u/7437046?v=4)](https://github.com/Marcuzzz "Marcuzzz (1 commits)")[![mike-kramer](https://avatars.githubusercontent.com/u/9973256?v=4)](https://github.com/mike-kramer "mike-kramer (1 commits)")[![pistej](https://avatars.githubusercontent.com/u/9282821?v=4)](https://github.com/pistej "pistej (1 commits)")[![Sensetivity](https://avatars.githubusercontent.com/u/4289543?v=4)](https://github.com/Sensetivity "Sensetivity (1 commits)")[![brussens](https://avatars.githubusercontent.com/u/2656715?v=4)](https://github.com/brussens "brussens (1 commits)")[![stefandoorn](https://avatars.githubusercontent.com/u/4903082?v=4)](https://github.com/stefandoorn "stefandoorn (1 commits)")[![filipe1309](https://avatars.githubusercontent.com/u/2081014?v=4)](https://github.com/filipe1309 "filipe1309 (1 commits)")

---

Tags

yii2yiimaintenancemode

### Embed Badge

![Health badge](/badges/malsa-yii2-maintenance-mode/health.svg)

```
[![Health](https://phpackages.com/badges/malsa-yii2-maintenance-mode/health.svg)](https://phpackages.com/packages/malsa-yii2-maintenance-mode)
```

###  Alternatives

[brussens/yii2-maintenance-mode

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

78260.9k5](/packages/brussens-yii2-maintenance-mode)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
