mbs047 / laravel-status-probe
Configurable health and metadata endpoints for Laravel apps monitored by MBS Uptime Monitor.
Requires
- php: ^8.2
- illuminate/cache: ^11.0|^12.0|^13.0
- illuminate/console: ^11.0|^12.0|^13.0
- illuminate/contracts: ^11.0|^12.0|^13.0
- illuminate/database: ^11.0|^12.0|^13.0
- illuminate/events: ^11.0|^12.0|^13.0
- illuminate/http: ^11.0|^12.0|^13.0
- illuminate/queue: ^11.0|^12.0|^13.0
- illuminate/routing: ^11.0|^12.0|^13.0
- illuminate/support: ^11.0|^12.0|^13.0
Requires (Dev)
- orchestra/testbench: ^9.0|^10.0|^11.0
- phpunit/phpunit: ^11.5|^12.0
This package is auto-updated.
Last update: 2026-03-22 17:02:37 UTC
README
mbs047/laravel-status-probe adds authenticated health and metadata endpoints
to a Laravel application so it can be monitored by an external status system.
This package is meant to be installed inside the app you want to monitor. It does not create a public status page by itself. Instead, it exposes structured probe data that a status monitor can import or register against.
Documentation
- docs/installation.md Installation, configuration, auth, routes, and heartbeat setup.
- docs/connecting-to-monitor.md Pull and push registration flows for connecting the package to a status monitor.
- docs/custom-contributors.md Extending the package with custom probe contributors.
What It Does
- registers a health endpoint, default
GET /status/health - registers a metadata endpoint, default
GET /status/metadata - protects both endpoints with a bearer token by default
- exposes built-in probes for
app,db, andcache - supports optional heartbeat-driven probes for
queueandscheduler - can push its registration payload to a remote monitor
- supports custom contributors through a simple contract
Requirements
- PHP
^8.2 - Laravel
11,12, or13 - a correct
APP_URLvalue in the monitored application
Installation
composer require mbs047/laravel-status-probe php artisan status-probe:install
The install command will:
- publish
config/status-probe.php - seed missing
.envvalues - print the next steps for connecting to your monitor
Quick Start
After installation, make sure these values exist in your .env:
STATUS_PROBE_APP_ID= STATUS_PROBE_TOKEN= STATUS_PROBE_HEALTH_PATH=status/health STATUS_PROBE_METADATA_PATH=status/metadata STATUS_MONITOR_URL= STATUS_MONITOR_TOKEN= STATUS_MONITOR_VERIFY=true STATUS_MONITOR_CA_PATH=
Important notes:
STATUS_PROBE_TOKENprotects the probe routes by defaultAPP_URLshould be set correctly so the metadata payload contains valid URLsSTATUS_MONITOR_URLandSTATUS_MONITOR_TOKENare only needed if you want the monitored app to push its registration into a remote monitorSTATUS_MONITOR_VERIFYcontrols TLS certificate verification when the package calls the monitor over HTTPSSTATUS_MONITOR_CA_PATHlets you point to a local CA bundle when the monitor uses a private or self-signed certificate chain
Once installed, your app will expose:
GET /status/healthGET /status/metadata
Both routes use the configured middleware stack plus the package auth
middleware. By default, that means the routes live in the api middleware
group and require a bearer token.
Security
The default setup is intentionally private.
- bearer token auth is enabled by default
- requests without a valid token receive
401 Unauthorized - if the token is missing from config, the package returns
503so the app does not silently expose an unprotected probe surface
Do not expose these endpoints publicly without understanding the tradeoff. Even if the data looks harmless, the probe surface reveals internals about your application runtime and infrastructure.
Health Payload
The health endpoint returns a single JSON payload with an overall status and a set of named checks:
{
"overall_status": "operational",
"generated_at": "2026-03-22T12:00:00+00:00",
"service": {
"name": "Billing API",
"slug": "billing-api",
"description": "Internal billing application"
},
"checks": {
"app": {
"label": "Application",
"description": "Laravel application runtime bootstrap health.",
"status": "operational",
"summary": "Laravel application booted successfully.",
"details": {}
},
"db": {
"label": "Database",
"description": "Primary database connection round trip.",
"status": "operational",
"summary": "Database query round trip succeeded.",
"details": {}
}
}
}
Supported status values:
operationaldegradedpartial_outagemajor_outage
If a contributor throws an exception, the package catches it and reports that
contributor as a major_outage instead of breaking the whole endpoint.
Metadata Payload
The metadata endpoint returns the registration contract a monitor can use to create services, components, and HTTP checks automatically.
It includes:
- stable
app_id - service name, slug, and description
- the public health and metadata URLs
- auth mode
- component definitions
- suggested HTTP check recipes for each component
Each component includes a status_json_path like
checks.db.status, which lets the monitor read one probe status from the
shared health payload.
Connecting To A Monitor
There are two common ways to connect this package to a monitor.
Pull Model
Your monitor fetches the metadata endpoint, reads the service/component definitions, and creates checks against the shared health URL.
For this model, you usually only need:
STATUS_PROBE_TOKEN- a correct
APP_URL
Push Model
If your monitor accepts probe registrations, configure:
STATUS_MONITOR_URL=https://status.example.com STATUS_MONITOR_TOKEN=your-monitor-token
Then run:
php artisan status-probe:register
That command posts the metadata payload to:
POST {STATUS_MONITOR_URL}/api/integrations/probes/register
Local HTTPS Development
If your monitor runs on a local HTTPS domain such as https://uptime.test
with a self-signed or private CA certificate, registration may fail during the
TLS handshake.
You have three safe options:
- trust the local CA and point the package to it
- disable monitor certificate verification in local development only
- use the one-off insecure flag just for the registration command
Examples:
STATUS_MONITOR_VERIFY=false
STATUS_MONITOR_CA_PATH=/path/to/local-ca.pem
php artisan status-probe:register --insecure
Use --insecure only for local development. Prefer STATUS_MONITOR_CA_PATH
when you have a local CA bundle available.
Built-In Contributors
Enabled by default:
app: verifies the Laravel app booted successfullydb: performs a database round trip withselect 1cache: performs a cache write/read/delete cycle
Available but disabled by default:
queue: checks freshness of a queue heartbeat written from the queue loopscheduler: checks freshness of a scheduler heartbeat written from a command
You can toggle these in config/status-probe.php:
'contributors' => [ 'app' => true, 'db' => true, 'cache' => true, 'queue' => true, 'scheduler' => true, ],
Queue And Scheduler Heartbeats
Scheduler
Enable the scheduler contributor, then record a heartbeat every minute from
your Laravel scheduler:
use Illuminate\Support\Facades\Schedule; Schedule::command('status-probe:heartbeat scheduler')->everyMinute();
The scheduler contributor reports a failure if the heartbeat becomes older than
heartbeat.scheduler_max_age_seconds.
Queue
Enable the queue contributor and run a normal Laravel queue worker. The
package listens to the worker loop and refreshes a queue heartbeat while the
worker is alive.
The queue contributor reports a failure if the heartbeat becomes older than
heartbeat.queue_max_age_seconds.
For multi-server or container deployments, use a shared cache store for heartbeat data if your queue workers and HTTP app instances do not share local state.
Configuration
The published config file is config/status-probe.php.
Main options:
app_id: stable identifier for the monitored appservice_name,service_slug,service_description: service metadatahealth_path,metadata_path: route pathsmiddleware: middleware stack used for the probe routesauth.mode,auth.token: route auth configurationmonitor.url,monitor.token: remote monitor registration settingsmonitor.interval_minutes,timeout_seconds,failure_threshold,recovery_threshold: defaults exposed in metadata for monitor-created checksheartbeat.store: optional cache store for heartbeatsheartbeat.queue_max_age_seconds,heartbeat.scheduler_max_age_seconds: stale-heartbeat thresholds
Custom Contributors
You can add your own contributors for app-specific dependencies such as search, object storage, Redis, or external upstreams.
Implement Mbs047\LaravelStatusProbe\Contracts\ProbeContributor, bind it in
the container, and tag it with status-probe.contributors:
use Mbs047\LaravelStatusProbe\Contracts\ProbeContributor; use Mbs047\LaravelStatusProbe\Enums\ProbeStatus; use Mbs047\LaravelStatusProbe\ProbeResult; $this->app->singleton(SearchProbe::class, function () { return new class implements ProbeContributor { public function key(): string { return 'search'; } public function label(): string { return 'Search'; } public function description(): ?string { return 'Search cluster availability.'; } public function defaultCheckConfig(): array { return []; } public function resolve(): ProbeResult { return new ProbeResult(ProbeStatus::Operational, 'Search is healthy.'); } }; }); $this->app->tag(SearchProbe::class, 'status-probe.contributors');
Custom contributors automatically appear in both:
- the health payload
- the metadata payload used for registration/import
Commands
php artisan status-probe:installPublishes config and seeds missing environment values.php artisan status-probe:registerPushes the registration payload to the configured monitor.php artisan status-probe:heartbeat schedulerRecords a scheduler heartbeat timestamp.
Testing
composer test
License
MIT