nowo-tech / maintenance-mode-bundle
Symfony bundle to put a site into maintenance mode with configurable exclusions, panel CRUD, and pluggable storage.
Package info
github.com/nowo-tech/MaintenanceModeBundle
Type:symfony-bundle
pkg:composer/nowo-tech/maintenance-mode-bundle
Requires
- php: >=8.2 <8.6
- symfony/config: ^7.0 || ^8.0
- symfony/console: ^7.0 || ^8.0
- symfony/dependency-injection: ^7.0 || ^8.0
- symfony/event-dispatcher: ^7.0 || ^8.0
- symfony/http-foundation: ^7.0 || ^8.0
- symfony/http-kernel: ^7.0 || ^8.0
- symfony/routing: ^7.0 || ^8.0
- symfony/security-csrf: ^7.0 || ^8.0
- symfony/yaml: ^7.0 || ^8.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.0
- nowo-tech/phpstan-frankenphp: ^1.0
- phpstan/extension-installer: ^1.4
- phpstan/phpstan: ^2.0
- phpstan/phpstan-phpunit: ^2.0
- phpstan/phpstan-symfony: ^2.0
- phpunit/phpunit: ^10.0
- rector/rector: ^2.0
- symfony/framework-bundle: ^7.0 || ^8.0
- symfony/twig-bundle: ^7.0 || ^8.0
- twig/twig: ^3.12
Suggests
- symfony/flex: For automatic recipe installation
- symfony/security-bundle: Optional; wire a custom MaintenanceAccessGateInterface for your security setup
- symfony/translation: Required for |trans in panel and public maintenance templates
- symfony/twig-bundle: Required to render maintenance and panel templates
README
⭐ Found this useful? Install from Packagist · Give it a star on GitHub so more developers can find it.
Maintenance Mode Bundle — Put a Symfony site into maintenance mode (HTTP 503) with configurable exclusions, a Twig admin panel, scheduled windows, append-only history, and pluggable storage / access gates. Tested on Symfony 7.4, 8.0, and 8.1 (also compatible with Symfony 7.0–7.3) · PHP 8.2+ (Symfony 8.x requires PHP 8.4+).
This bundle is FrankenPHP worker mode friendly.
Features
- 503 listener — Configurable-priority
kernel.requestinterceptor (default after router), HTML or JSON, dynamicRetry-After,Cache-Control: no-store. - Exclusions — Exact paths, prefixes, route names, globs,
#regex#/~regex~, IPs/CIDR,#[ExcludeFromMaintenance], soft bypass token. - Admin panel — Enable / disable / schedule / clear schedule / history under a configurable prefix (default
/_maintenance). - CLI —
enable/disable/status/hash-passwordfor deploys and ops scripts. - Events & Twig — Domain events on state changes;
nowo_maintenance_is_enabled()/nowo_maintenance_state(). - Password gate — Optional
password_hash(bcrypt / argon2id); replaceable viaMaintenanceAccessGateInterface. - Pluggable storage — Filesystem JSON/JSONL by default; swap for Doctrine or anything else via DI.
Installation
composer require nowo-tech/maintenance-mode-bundle
With Symfony Flex, the recipe registers the bundle and adds config. Without Flex, see docs/INSTALLATION.md.
# config/routes.yaml nowo_maintenance_mode: resource: '@NowoMaintenanceModeBundle/Resources/config/routes.yaml'
Configuration
nowo_maintenance_mode: enabled: true default_message: "We're making a few gentle improvements. Everything you care about is safe." panel: path_prefix: '/_maintenance' security: password_protection: true password_hash: '%env(MAINTENANCE_PASSWORD_HASH)%' exclusions: paths: ['/health'] path_prefixes: ['/api/health']
Usage
Open /_maintenance to toggle maintenance. Visitors hit the public page with HTTP 503; excluded routes and the panel keep working. In dev, preview the configured page at /_maintenance_preview (like /_error/503). Demo gallery: /examples.
$maintenance->enable('Deploy in progress', 'ops'); $maintenance->disable('ops');
See docs/USAGE.md.
Documentation
- Installation
- Configuration
- Usage
- Contributing
- Code of Conduct
- Changelog
- Upgrading
- Release
- Security
- Engram
- Spec-driven development
- GitHub Spec Kit
Additional documentation
Requirements
- PHP
>=8.2(<8.6); Symfony 8.0 and 8.1 require PHP 8.4+ - Symfony 7.4, 8.0, or 8.1 (minimum supported minors; also works on Symfony 7.0–7.3 via
composer.jsonconstraints) - Twig for the maintenance page and panel templates
Development
make up
make install
make test
make cs-check
make phpstan
make release-check
Demo
| Demo | Symfony | PHP | Default port |
|---|---|---|---|
demo/symfony8 |
8.1 | 8.5 | 8055 |
Runs FrankenPHP + Caddy (FRANKENPHP_MODE=worker by default). Panel password: maintenance. See docs/DEMO-FRANKENPHP.md.
make -C demo help
make -C demo up-symfony8
Tests and coverage
- Tests: PHPUnit (PHP)
- PHP: 100% Lines (run
make coverage-check)
License and author
MIT · Nowo.tech · Héctor Franco Aceituno
