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

ActiveYii2-extension

humanized/yii2-maintenance
==========================

A database driven maintenance module for Yii2 projects

097PHP

Since Jan 20Pushed 9y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

Yii2 Maintenance - README
=========================

[](#yii2-maintenance---readme)

A module for providing maintenance mode redirection for Yii2 web applications

Installation
------------

[](#installation)

### Install Using Composer

[](#install-using-composer)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
$ php composer.phar require humanized/yii2-maintenance "dev-master"

```

or add

```
"humanized/yii2-maintenance": "dev-master"

```

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

Configuration
-------------

[](#configuration)

### Prerequisites

[](#prerequisites)

By default, redirection is disabled for routes set through Yii::$app-&gt;errorHandler-&gt;errorAction and Yii::$app-&gt;user-&gt;loginUrl\[0\]

Ensure that appropriate values are set through respective component configuration parameters.

This can be enabled by setting the whitelistLoginUrl and whitelistErrorAction to false

### Step 1

[](#step-1)

The module works by creating/dropping a file somewhere on the filesystem. To specify it's path, add an alias "@maintenance" to the the config/bootstrap file:

```
Yii::setAlias('@common', dirname(__DIR__));
Yii::setAlias('@backend', dirname(dirname(__DIR__)) . '/backend');
Yii::setAlias('@frontend', dirname(dirname(__DIR__)) . '/frontend');
Yii::setAlias('@maintenance', dirname(dirname(__DIR__)) . '/frontent/runtime/maintenance');
```

Add specific aliases to different application config/bootstap files to allow maintenance-mode on different applications within the same yii project.

### Step 2

[](#step-2)

The module comes with a redirecton behavior, which is triggered before a controller-action event. When attached to a controller, a 503 - Service Unavailable - HTTP exception is thrown when maintenance mode is enabled.

To call the behavior before each request of the application to be placed under maintenance, add following lines to the configuration file:

```
return [
    'id' => 'application-name',
    ...
    'as beforeAction'=>[
      'class'=>'humanized\maintenance\components\behaviors\RedirectionBehavior',
    ]
    ...
],
```

For full instructions on how to configure the behavior, check the [CONFIG](CONFIG.md)-file.

### Step 3 (Optional)

[](#step-3-optional)

#### Command Line Interface

[](#command-line-interface)

Add following lines to the console configuration file to enable the CLI:

```
'modules' => [
    'maintenance' => [
        'class' => 'humanized\maintenance\Module',
    ],
],
```

Adding these lines allows access to the CLI provided by the module. Here, the chosen module-name is maintenance, as such the various routes will be available at maintenance/controller-id/action-id, though any module-name can be chosen.

For full instructions on how to use the command-line interface portion of this module, check the [CLI](CLI.md)-file.

#### Graphical User Interface

[](#graphical-user-interface)

This package provides several components for building custom GUI solutions:

First, the various controller actions for toggling maintenance mode are available in humanized\\maintenance\\actions.
These external actions can then be attached to the

Add following lines to the web-application configuration file to enable the sample controller :

```
'modules' => [
    'maintenance' => [
        'class' => 'humanized\maintenance\Module',
    ],
],
```

Adding these lines allows access to the CLI provided by the module. Here, the chosen module-name is maintenance, as such the various routes will be available at maintenance/controller-id/action-id, though any module-name can be chosen.

For full instructions on how to use the command-line interface portion of this module, check the [CLI](CLI.md)-file.

Important Note
--------------

[](#important-note)

The module conflicts with the Yii2 debug toolbar, which is enabled by default in a standard development environment. The module functions just fine, when the debug toolbar is disabled, i.e. as is the default case in a standard production environment

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/1a07fca5b8f6fe268961a6744dbfd2175da8c785f5e26b2edaeb552f9bbcabd2?d=identicon)[jeffrey.geyssens](/maintainers/jeffrey.geyssens)

---

Top Contributors

[![jeffrico](https://avatars.githubusercontent.com/u/3632182?v=4)](https://github.com/jeffrico "jeffrico (28 commits)")

### Embed Badge

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

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

PHPackages © 2026

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