phil / monitoring-bundle
The surveillance of a Symfony site: health checks for the database, cache pools, Messenger transports and storage, endpoints for uptime monitors, a maintenance mode, heartbeats and a dead-man switch for scheduled tasks, and a page of the Messenger queues
Package info
github.com/parler-haut-interagir-librement/monitoring-bundle
Type:symfony-bundle
pkg:composer/phil/monitoring-bundle
Requires
- php: >=8.5
- ext-mbstring: *
- psr/cache: ^3.0
- psr/clock: ^1.0
- psr/container: ^2.0
- psr/log: ^3.0
- symfony/config: ^8.2
- symfony/console: ^8.2
- symfony/dependency-injection: ^8.2
- symfony/filesystem: ^8.2
- symfony/http-foundation: ^8.2
- symfony/http-kernel: ^8.2
- symfony/lock: ^8.2
- symfony/messenger: ^8.2
- symfony/notifier: ^8.2
Requires (Dev)
- doctrine/dbal: ^4.5
- league/flysystem: ^3.30
- league/flysystem-memory: ^3.29
- phpunit/phpunit: ^13.4
- symfony/browser-kit: ^8.2
- symfony/cache: ^8.2
- symfony/clock: ^8.2
- symfony/framework-bundle: ^8.2
- symfony/routing: ^8.2
- symfony/scheduler: ^8.2
- symfony/security-core: ^8.2
- symfony/security-csrf: ^8.2
- symfony/twig-bridge: ^8.2
- symfony/twig-bundle: ^8.2
- twig/twig: ^3.21
Suggests
- doctrine/dbal: To check DBAL connections
- league/flysystem: To check Flysystem storages
- symfony/routing: For the health endpoints and the page of the queues
- symfony/scheduler: To beat a task each time its scheduled message runs
- symfony/security-core: For the roles of the maintenance mode and of the page of the queues
- symfony/security-csrf: For the actions of the page of the queues
- twig/twig: For the maintenance page and the page of the queues
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-11-11 13:32:01 UTC
README
The surveillance of a Symfony site: its health, a maintenance mode, the heartbeats of its scheduled tasks and its Messenger queues.
phil/monitoring-bundle gathers in one package what an operator watches on a running site. Health checks — a DBAL
connection, a cache pool on Valkey or Redis, a Messenger transport, a local directory, a Flysystem storage, or any
service of the application implementing HealthCheck — run behind the endpoints of external uptime monitors:
liveness, readiness, and a detailed view for the bearer of a token. A maintenance mode, enabled from the console,
answers 503 with Retry-After to everyone but the allowed addresses, roles and routes. Each scheduled task beats when
it runs, from Symfony Scheduler or from a cron job, and a dead-man switch alerts through Symfony Notifier the task that
did not run in its window. A page shows the Messenger transports, their failed messages, and retries or removes them,
for one role.
It is for any Symfony application that runs in production and is watched by someone. Another bundle — a public status
page, a dashboard — reads it through MonitoringStatus, a stable read model of the checks, the tasks and the
maintenance. Nothing the bundle shows carries more than names, statuses, counts and moments: no secret, no host, no
personal data.
It is built on the components Symfony already ships: HttpKernel and HttpFoundation for the endpoints and the maintenance mode, Messenger, Scheduler and Notifier for the queues and the tasks, Cache and Filesystem for the stores, Console for the commands; DBAL, Flysystem, Twig and Security when the application has them.
Status
| Part | State |
|---|---|
| Health checks: DBAL, cache pools, Messenger transports, directories, Flysystem, the application's own | Implemented and tested |
| Liveness, readiness and a detailed view behind a token, in JSON | Implemented and tested |
Maintenance mode: flag file or cache key, 503 with Retry-After, allow-lists, console command |
Implemented and tested |
| Heartbeats from Symfony Scheduler and from cron, a dead-man switch through Symfony Notifier | Implemented and tested |
| The page of the Messenger queues: counts, failed messages, retry and removal behind a role | Implemented and tested |
MonitoringStatus, the read model for another bundle |
Implemented and tested |
Components of phil/ux-bundle in the pages |
Not started: the pages extend the application's layout |
Documentation
| Document | What it covers |
|---|---|
| Installation | Requirements, installing, the routes, the stores. |
| Configuration | Every key of phil_monitoring. |
| Health checks | The checks of the bundle, the endpoints of the monitors, the detailed view. |
| Maintenance mode | Enabling it, the allow-lists, the page visitors get. |
| Heartbeats | Declaring tasks, beating from Scheduler or cron, the dead-man switch and its alerts. |
| Messenger queues | The page of the queues, its role, its actions. |
| Extension points | A check of your own, the stores, MonitoringStatus, the templates. |
| Testing | The bundle's tests, and how to test an application that uses it. |
| Reference | Every class, service, tag, route, command and template of the bundle. |
Quick start
composer require phil/monitoring-bundle
# config/packages/phil_monitoring.yaml phil_monitoring: health: token: '%env(MONITORING_TOKEN)%' database: [default] cache_pools: [cache.app] messenger: { async: 100, failed: 0 } heartbeats: tasks: backup: { every: 86400, grace: 3600 }
# config/routes/phil_monitoring.yaml phil_monitoring_health: resource: '@PhilMonitoringBundle/config/routes/health.php' prefix: /_health
curl https://example.com/_health/ready # {"status":"up"} bin/console phil:monitoring:maintenance enable --retry-after=600
Requirements
PHP 8.5 or later and Symfony 8.2 or later. doctrine/dbal, league/flysystem, symfony/scheduler, symfony/routing,
twig/twig, symfony/security-core and symfony/security-csrf — each only for the part that uses it.
Contributing
Contributions are welcome on the PHIL monorepo: read the contribution guide and the code of conduct. Report a vulnerability privately, as the security policy explains, never in a public issue.
License
MIT, © Philippe Gamache, doing business as Le Gnome Archiviste; a Parler Haut Interagir Librement project. See LICENSE.