PHPackages                             nimblephp/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. [Utility &amp; Helpers](/categories/utility)
4. /
5. nimblephp/maintenance

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

nimblephp/maintenance
=====================

Maintenance mode for NimblePHP with an IP allow-list. Stores its configuration in the settings module.

00PHP

Since Jun 30Pushed todayCompare

[ Source](https://github.com/NimbleMVC/Maintenance)[ Packagist](https://packagist.org/packages/nimblephp/maintenance)[ RSS](/packages/nimblephp-maintenance/feed)WikiDiscussions main Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

nimblephp/maintenance
=====================

[](#nimblephpmaintenance)

Maintenance mode for NimblePHP. While enabled, every request gets a `503` page except requests from allow-listed IP addresses.

Requires **nimblephp/settings** — the whole configuration (on/off, message, allowed IPs, retry-after) is stored there, so this module ships **no migration and no table of its own**.

Contents
--------

[](#contents)

- `Module` — registers the maintenance middleware, CLI commands and translations
- `Maintenance` — facade for toggling and configuring maintenance mode (backed by settings)
- `MaintenanceMiddleware` — blocks requests with a 503 page while enabled
- `Commands/MaintenanceCommand` — CLI commands
- `Lang/` — translations (`en`, `pl`) for the maintenance page

Translations
------------

[](#translations)

The maintenance page title and default message are translated via the framework translation system (keys `module.maintenance.title` and `module.maintenance.message`), shipped for `en` and `pl`, and rendered in the current language. A custom message set with `Maintenance::enable('...')` overrides the translated default.

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

[](#installation)

```
composer require nimblephp/maintenance
```

The `settings` module migration must have been run (it provides the storage table).

CLI
---

[](#cli)

The module ships console commands (auto-registered via the module system). A fresh install needs nothing in the database — `maintenance:on` creates the settings rows:

```
php vendor/bin/nimble maintenance:on                       # enable
php vendor/bin/nimble maintenance:on --message="Back at 18:00"
php vendor/bin/nimble maintenance:allow-ip 127.0.0.1       # let yourself through
php vendor/bin/nimble maintenance:status                   # show state
php vendor/bin/nimble maintenance:disallow-ip 127.0.0.1
php vendor/bin/nimble maintenance:off                      # disable
```

Usage (PHP)
-----------

[](#usage-php)

```
use NimblePHP\Maintenance\Maintenance;

// turn on (optionally with a custom message)
Maintenance::enable('Back in 10 minutes.');

// let yourself through
Maintenance::allowIp('127.0.0.1');

// status / config
Maintenance::isEnabled();        // bool
Maintenance::allowedIps();       // ['127.0.0.1', ...]
Maintenance::message();          // string
Maintenance::isAllowed($ip);     // true when off or IP allow-listed

// turn off
Maintenance::disable();
```

When enabled, `MaintenanceMiddleware` (registered at high priority) intercepts requests in `beforeController`: allow-listed IPs pass through, everyone else gets a `503` with a `Retry-After` header. The check **fails open** — any error while reading the state lets the request through, so a misconfiguration can't brick the site.

View / overriding the page
--------------------------

[](#view--overriding-the-page)

The page is rendered through the framework `view` service from the container, so whatever view module is installed renders it transparently:

- **Twig module installed** → Twig owns the `view` service, so the page is a Twig template. The module ships `src/View/maintenance.twig` and registers its own view directory in the Twig loader, so the default works out of the box. Custom views must be `.twig`.
- **No Twig (base renderer)** → the module ships `src/View/maintenance.phtml`. Custom views are `.phtml` under `App/View`.

Override the page with `maintenance.view`:

```
php vendor/bin/nimble maintenance:view test          # Twig: App/View/test.twig | base: App/View/test.phtml
php vendor/bin/nimble maintenance:view errors/down   # nested: App/View/errors/down.{twig|phtml}
php vendor/bin/nimble maintenance:view --clear       # back to the bundled default
```

```
Maintenance::setView('test');
Maintenance::clearView();
```

A flat name (e.g. `test`) maps to `App/View/test.twig` under Twig or `App/View/test.phtml` under the base renderer. Your view receives `title`, `message`, `lang` and `retryAfter`. If the view service or the view file is unavailable, a built-in `503` page is rendered as a fallback, so the module always works — even without a view module installed.

Configuration keys (in settings)
--------------------------------

[](#configuration-keys-in-settings)

KeyTypeDefault`maintenance.enabled`bool`false``maintenance.message`stringgeneric message`maintenance.allowed_ips`json (array)`[]``maintenance.retry_after`int (seconds)`3600`> The client IP is read from `REMOTE_ADDR`. Behind a proxy/load balancer, make sure that reflects the real client (or add the proxy IP to the allow-list).

###  Health Score

20

—

LowBetter than 13% of packages

Maintenance65

Regular maintenance activity

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity11

Early-stage or recently created project

 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/b71301619d71d2798d3a84f23de616ac1f1c185ab72e4f03e925cff169b03a0d?d=identicon)[krzysztofzylka](/maintainers/krzysztofzylka)

---

Top Contributors

[![krzysztofzylka](https://avatars.githubusercontent.com/u/41385342?v=4)](https://github.com/krzysztofzylka "krzysztofzylka (1 commits)")

### Embed Badge

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

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

###  Alternatives

[silverstripe/multiform

SilverStripe forms with multiple steps, flow control and state persistence

3156.8k3](/packages/silverstripe-multiform)

PHPackages © 2026

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