PHPackages                             brussens/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. brussens/yii2-maintenance-mode

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

brussens/yii2-maintenance-mode
==============================

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

1.2.2(4y ago)78256.3k—3.4%32[3 issues](https://github.com/brussens/yii2-maintenance-mode/issues)5MITPHPPHP &gt;=5.4.0

Since Feb 9Pushed 4y ago6 watchersCompare

[ Source](https://github.com/brussens/yii2-maintenance-mode)[ Packagist](https://packagist.org/packages/brussens/yii2-maintenance-mode)[ RSS](/packages/brussens-yii2-maintenance-mode/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (1)Versions (14)Used By (5)

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

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

[![Latest Stable Version](https://camo.githubusercontent.com/150292469518726cf56d8fd7d40659df147f4f0381fa358ab9ede98c8b959fe5/68747470733a2f2f706f7365722e707567782e6f72672f6272757373656e732f796969322d6d61696e74656e616e63652d6d6f64652f762f737461626c65)](https://packagist.org/packages/brussens/yii2-maintenance-mode)[![Total Downloads](https://camo.githubusercontent.com/7492d4cf9a95ba835574e38150043e091ca53d17de6880c6c58ea55b7415a339/68747470733a2f2f706f7365722e707567782e6f72672f6272757373656e732f796969322d6d61696e74656e616e63652d6d6f64652f646f776e6c6f616473)](https://packagist.org/packages/brussens/yii2-maintenance-mode)[![License](https://camo.githubusercontent.com/4710cfe2ce85b8fe9aed8878490406202f72ca5e0c0387e5701f9b4b3a706f75/68747470733a2f2f706f7365722e707567782e6f72672f6272757373656e732f796969322d6d61696e74656e616e63652d6d6f64652f6c6963656e7365)](https://packagist.org/packages/brussens/yii2-maintenance-mode)

Install
-------

[](#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' => [
    'brussens\maintenance\Maintenance'
],
...
'container' => [
    'singletons' => [
        'brussens\maintenance\Maintenance' => [
            'class' => 'brussens\maintenance\Maintenance',

            // Route to action
            'route' => 'maintenance/index',

            // Filters. Read Filters for more info.
            'filters' => [
                [
                    'class' => 'brussens\maintenance\filters\RouteFilter',
                    'routes' => [
                        'debug/default/toolbar',
                        'debug/default/view',
                        'site/login',
                    ]
                ]
            ],

            // HTTP Status Code
            'statusCode' => 503,

            //Retry-After header
            'retryAfter' => 120 // or Wed, 21 Oct 2015 07:28:00 GMT for example
        ],
        'brussens\maintenance\StateInterface' => [
            'class' => 'brussens\maintenance\states\FileState',

            // optional: use different filename for controlling maintenance state:
            // 'fileName' => 'myfile.ext',

            // optional: use different directory for controlling maintenance state:
            // 'directory' => '@mypath',
        ]
    ]
]
```

Filters
-------

[](#filters)

You can use filters for allow excepts:

```
'container' => [
    'singletons' => [
        'brussens\maintenance\Maintenance' => [
            'class' => 'brussens\maintenance\Maintenance',
            // Route to action
            'route' => 'maintenance/index',
            // Filters. Read Filters for more info.
            'filters' => [
                //Allowed routes filter. Your can allow debug panel routes.
                [
                    'class' => 'brussens\maintenance\filters\RouteFilter',
                    'routes' => [
                        'debug/default/toolbar',
                        'debug/default/view',
                        'site/login',
                    ]
                ],
                // Allowed roles filter
                [
                    'class' => 'brussens\maintenance\filters\RoleFilter',
                    'roles' => [
                        'administrator',
                    ]
                ],
                // Allowed IP addresses filter
                [
                    'class' => 'brussens\maintenance\filters\IpFilter',
                    'ips' => [
                        '127.0.0.1',
                    ]
                ],
                //Allowed user names
                [
                    'class' => 'brussens\maintenance\filters\UserFilter',
                    'checkedAttribute' => 'username',
                    'users' => [
                        'BrusSENS',
                    ],
                ]
            ],
        ]
    ]
]
```

You can create custom filter:

```
class MyCustomFilter extends Filter
{
    public $time;

    /**
     * @return bool
     */
    public function isAllowed()
    {
        return (bool) $this->time > 3600;
    }
}
```

Set maintenance mode by console or dashboard
--------------------------------------------

[](#set-maintenance-mode-by-console-or-dashboard)

Add to your console or common config file:

```
'container' => [
    'singletons' => [
        'brussens\maintenance\StateInterface' => [
            'class' => 'brussens\maintenance\states\FileState',
            // optional: use different filename for controlling maintenance state:
            // 'fileName' => 'myfile.ext',

            // optional: use different directory for controlling maintenance state:
            // 'directory' => '@mypath',
        ]
    ]
],
'controllerMap' => [
      'maintenance' => [
          'class' => 'brussens\maintenance\commands\MaintenanceController',
      ],
],
```

Now you can set mode by command:

```
php yii maintenance/enable

```

```
php yii maintenance/disable

```

###  Health Score

43

—

FairBetter than 91% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity49

Moderate usage in the ecosystem

Community30

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 58.3% of commits — single point of failure

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 ~219 days

Recently: every ~248 days

Total

13

Last Release

1485d ago

Major Versions

0.2.6 → 1.0.0-alpha2019-07-12

### Community

Maintainers

![](https://www.gravatar.com/avatar/436a63d75811386f486820ea2de0060dc20d95294beee6555edf6ea7c03bc367?d=identicon)[brussens](/maintainers/brussens)

---

Top Contributors

[![brussens](https://avatars.githubusercontent.com/u/2656715?v=4)](https://github.com/brussens "brussens (14 commits)")[![filipe1309](https://avatars.githubusercontent.com/u/2081014?v=4)](https://github.com/filipe1309 "filipe1309 (1 commits)")[![Ibra1994](https://avatars.githubusercontent.com/u/15104029?v=4)](https://github.com/Ibra1994 "Ibra1994 (1 commits)")[![iyiolapeter](https://avatars.githubusercontent.com/u/8983938?v=4)](https://github.com/iyiolapeter "iyiolapeter (1 commits)")[![lenarx](https://avatars.githubusercontent.com/u/13827900?v=4)](https://github.com/lenarx "lenarx (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)")[![mrstroz](https://avatars.githubusercontent.com/u/771899?v=4)](https://github.com/mrstroz "mrstroz (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)")[![stefandoorn](https://avatars.githubusercontent.com/u/4903082?v=4)](https://github.com/stefandoorn "stefandoorn (1 commits)")

---

Tags

yii2-extensionyii2-maintenance-modeyii2yiimaintenancemode

### Embed Badge

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

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

###  Alternatives

[kop/yii2-scroll-pager

Infinite AJAX scrolling for Yii2 ListView widget

180706.5k10](/packages/kop-yii2-scroll-pager)

PHPackages © 2026

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