PHPackages                             kagir/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. [Framework](/categories/framework)
4. /
5. kagir/yii2-maintenance-mode

ActiveYii2-extension[Framework](/categories/framework)

kagir/yii2-maintenance-mode
===========================

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

1.2.1(4y ago)00MITPHPPHP &gt;=5.4.0

Since Feb 9Pushed 4y agoCompare

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

READMEChangelog (1)Dependencies (1)Versions (13)Used By (0)

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 kagir/yii2-maintenance-mode "*"

```

or add

```
"kagir/yii2-maintenance-mode": "*"

```

to the require section of your `composer.json` file.

Add to your config file:

```
'bootstrap' => [
    'kagir\maintenance\Maintenance'
],
...
'container' => [
    'singletons' => [
        'kagir\maintenance\Maintenance' => [
            'class' => 'kagir\maintenance\Maintenance',

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

            // Filters. Read Filters for more info.
            'filters' => [
                [
                    'class' => 'kagir\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
        ],
        'kagir\maintenance\StateInterface' => [
            'class' => 'kagir\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' => [
        'kagir\maintenance\Maintenance' => [
            'class' => 'kagir\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' => 'kagir\maintenance\filters\RouteFilter',
                    'routes' => [
                        'debug/default/toolbar',
                        'debug/default/view',
                        'site/login',
                    ]
                ],
                // Allowed roles filter
                [
                    'class' => 'kagir\maintenance\filters\RoleFilter',
                    'roles' => [
                        'administrator',
                    ]
                ],
                // Allowed IP addresses filter
                [
                    'class' => 'kagir\maintenance\filters\IpFilter',
                    'ips' => [
                        '127.0.0.1',
                    ]
                ],
                //Allowed user names
                [
                    'class' => 'kagir\maintenance\filters\UserFilter',
                    'checkedAttribute' => 'username',
                    'users' => [
                        'Kagir',
                    ],
                ]
            ],
        ]
    ]
]
```

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' => [
        'kagir\maintenance\StateInterface' => [
            'class' => 'kagir\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' => 'kagir\maintenance\commands\MaintenanceController',
      ],
],
```

Now you can set mode by command:

```
php yii maintenance/enable

```

```
php yii maintenance/disable

```

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity0

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor2

2 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 ~210 days

Recently: every ~175 days

Total

12

Last Release

1796d ago

Major Versions

0.2.6 → 1.0.0-alpha2019-07-12

### Community

Maintainers

![](https://www.gravatar.com/avatar/6d2092decf542386bb377cb8c210eceff3c00e8963376c8d69fb62c1a0a16549?d=identicon)[kagir](/maintainers/kagir)

---

Top Contributors

[![brussens](https://avatars.githubusercontent.com/u/2656715?v=4)](https://github.com/brussens "brussens (13 commits)")[![kagir](https://avatars.githubusercontent.com/u/3176084?v=4)](https://github.com/kagir "kagir (6 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)")[![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)")[![filipe1309](https://avatars.githubusercontent.com/u/2081014?v=4)](https://github.com/filipe1309 "filipe1309 (1 commits)")

---

Tags

yii2yiimaintenancemode

### Embed Badge

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

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

###  Alternatives

[brussens/yii2-maintenance-mode

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

78256.3k5](/packages/brussens-yii2-maintenance-mode)[iiifx-production/yii2-autocomplete-helper

Yii2 Autocomplete Helper

4226.9k2](/packages/iiifx-production-yii2-autocomplete-helper)

PHPackages © 2026

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