Configuration
laravel-schedule-monitor is configured in config/schedule-monitor.php, and the Oh Dear settings can also be set with environment variables. This page lists every key with its type, default, and effect, explains how a published config file is merged with the package defaults, and shows a complete example.
Publishing the Config File
php artisan vendor:publish --provider="Spatie\ScheduleMonitor\ScheduleMonitorServiceProvider" --tag="schedule-monitor-config"
Without a published file the package defaults apply. The Oh Dear keys read environment variables, so most setups only need .env entries.
How Your File Is Merged with the Defaults
Laravel merges a package's default config with your published file one level deep: each top-level key you define (delete_log_items_older_than_days, date_format, models, oh_dear) replaces the package's value entirely. If you published the file with an older version of the package, your oh_dear array may lack newer keys such as retry_delay_ms or debug_logging. That is harmless: the code reads every Oh Dear key with a fallback, listed in the "Missing key" column below. To use a newer option, add the key to your published file (or republish and re-apply your changes).
All Keys
| Key | Type | Default | Environment variable | Missing key behaves as |
|---|---|---|---|---|
delete_log_items_older_than_days |
int | 30 |
||
date_format |
string | 'Y-m-d H:i:s' |
||
models.monitored_scheduled_task |
class | MonitoredScheduledTask::class |
||
models.monitored_scheduled_log_item |
class | MonitoredScheduledTaskLogItem::class |
||
oh_dear.api_token |
string | '' |
OH_DEAR_API_TOKEN |
null; API calls then fail, so keep the '' default |
oh_dear.monitor_id |
int | null |
OH_DEAR_MONITOR_ID |
Oh Dear sync skipped |
oh_dear.queue |
string | null |
OH_DEAR_QUEUE |
default queue |
oh_dear.ping_oh_dear_job |
class | PingOhDearJob::class |
PingOhDearJob |
|
oh_dear.retry_job_for_minutes |
int | 10 |
10 |
|
oh_dear.retry_delay_ms |
int | 10000 |
OH_DEAR_RETRY_DELAY_MS |
10000 |
oh_dear.silence_ping_oh_dear_job_in_horizon |
bool | true |
true |
|
oh_dear.send_starting_ping |
bool | false |
OH_DEAR_SEND_STARTING_PING |
false |
oh_dear.grace_time_in_minutes |
int | 5 |
5 |
|
oh_dear.endpoint_url |
string | null |
OH_DEAR_PING_ENDPOINT_URL |
Oh Dear's ping URL |
oh_dear.api_url |
string | 'https://ohdear.app/api/' |
OH_DEAR_API_URL |
'https://ohdear.app/api/' |
oh_dear.debug_logging |
bool | false |
OH_DEAR_DEBUG_LOGGING |
false |
General Settings
delete_log_items_older_than_days
| Property | Value |
|---|---|
| Type | int |
| Default | 30 |
The retention period of log items, in days. It is used by the prunable() query of MonitoredScheduledTaskLogItem: items whose created_at is at least this many days old are deleted when model:prune runs for the model. Nothing is deleted unless you schedule model:prune.
Pruning uses Laravel's MassPrunable, which deletes with a single query per chunk and does not fire model events. Task rows are never pruned, so the last_*_at timestamps survive.
date_format
| Property | Value |
|---|---|
| Type | string (PHP date() format) |
| Default | 'Y-m-d H:i:s' |
The format of all dates in the output of schedule-monitor:list. The column width is computed from the length of the current date in this format, so formats with variable-length parts (such as full month names) may not align perfectly.
'date_format' => 'd/m/Y H:i',
models
| Property | Value |
|---|---|
| Type | array of two class names |
| Default | the package's own models |
'models' => [
'monitored_scheduled_task' => Spatie\ScheduleMonitor\Models\MonitoredScheduledTask::class,
'monitored_scheduled_log_item' => Spatie\ScheduleMonitor\Models\MonitoredScheduledTaskLogItem::class,
],
Replace them with your own classes to add relationships, casts, a different connection or table, or extra methods. Your classes must extend the package models; this is checked every time the application boots. See Using Custom Models.
Oh Dear Settings
These keys live under oh_dear. None of them matter until monitor_id is set and the sync has stored ping URLs. The setup is explained in Oh Dear Setup.
oh_dear.api_token
| Property | Value |
|---|---|
| Type | string |
| Default | env('OH_DEAR_API_TOKEN', '') |
The API token used as a Bearer token for Oh Dear API calls (sync and verify). Create one at https://ohdear.app/user/api-tokens. Pings to the ping URLs do not use the token.
oh_dear.monitor_id
| Property | Value |
|---|---|
| Type | int |
| Default | env('OH_DEAR_MONITOR_ID') |
The Oh Dear monitor that owns the cron checks. When empty, the sync skips Oh Dear entirely. Each environment should use a different monitor, because a full sync replaces all cron checks of the monitor. Before version 4 this was site_id / OH_DEAR_SITE_ID (see Upgrading).
oh_dear.queue
| Property | Value |
|---|---|
| Type | string or null |
| Default | env('OH_DEAR_QUEUE') |
The queue name for ping jobs. A dedicated queue with its own worker is strongly recommended. See Choosing the Queue.
oh_dear.ping_oh_dear_job
| Property | Value |
|---|---|
| Type | class name |
| Default | Spatie\ScheduleMonitor\Jobs\PingOhDearJob::class |
The job class dispatched for each ping. It should extend PingOhDearJob. See Using a Custom Ping Job.
oh_dear.retry_job_for_minutes
| Property | Value |
|---|---|
| Type | int |
| Default | 10 |
How long after dispatch a ping job may still be retried by the queue (it is the job's retryUntil()). After that, the job is failed instead of retried.
oh_dear.retry_delay_ms
| Property | Value |
|---|---|
| Type | int (milliseconds) |
| Default | env('OH_DEAR_RETRY_DELAY_MS', 10_000) |
The pause between the three HTTP tries inside one job attempt. Lower it if failed attempts hold workers for too long; set it to 0 in tests.
oh_dear.silence_ping_oh_dear_job_in_horizon
| Property | Value |
|---|---|
| Type | bool |
| Default | true |
Adds PingOhDearJob to horizon.silenced when Horizon is installed. Has no effect without Horizon. Custom job classes are not added automatically.
oh_dear.send_starting_ping
| Property | Value |
|---|---|
| Type | bool |
| Default | env('OH_DEAR_SEND_STARTING_PING', false) |
Also pings Oh Dear when a run starts, and stops sending runtime with the finish ping. Use the literal true; a value like 1 only half-enables it. See Starting Pings.
oh_dear.grace_time_in_minutes
| Property | Value |
|---|---|
| Type | int |
| Default | 5 |
The default grace time for tasks without graceTimeInMinutes(). Despite living under oh_dear, it is also used for the late detection in schedule-monitor:list. It is stored per task during the sync, so changes take effect at the next sync.
oh_dear.endpoint_url
| Property | Value |
|---|---|
| Type | string or null |
| Default | env('OH_DEAR_PING_ENDPOINT_URL') |
An alternative base URL for pings. When set, each ping URL becomes this URL (trailing slash removed) plus / plus the cron check's UUID. Applied during the sync. See Custom Ping Endpoints.
oh_dear.api_url
| Property | Value |
|---|---|
| Type | string |
| Default | env('OH_DEAR_API_URL', 'https://ohdear.app/api/') |
The base URL of the Oh Dear API used by the sync and verify commands. A trailing slash is removed before endpoints are appended. You normally never change it.
oh_dear.debug_logging
| Property | Value |
|---|---|
| Type | bool |
| Default | env('OH_DEAR_DEBUG_LOGGING', false) |
Logs a warning with timing, connection, request, and response details for every failed ping attempt. See Debug Logging.
Environment Variables
| Variable | Config key |
|---|---|
OH_DEAR_API_TOKEN |
oh_dear.api_token |
OH_DEAR_MONITOR_ID |
oh_dear.monitor_id |
OH_DEAR_QUEUE |
oh_dear.queue |
OH_DEAR_SEND_STARTING_PING |
oh_dear.send_starting_ping |
OH_DEAR_PING_ENDPOINT_URL |
oh_dear.endpoint_url |
OH_DEAR_API_URL |
oh_dear.api_url |
OH_DEAR_RETRY_DELAY_MS |
oh_dear.retry_delay_ms |
OH_DEAR_DEBUG_LOGGING |
oh_dear.debug_logging |
As with any Laravel config, these are only read when the config is loaded: after changing .env on a server that runs php artisan config:cache, rebuild the cache.
Complete Example
A production setup with a dedicated ping queue, longer retention, and custom models:
<?php
return [
'delete_log_items_older_than_days' => 90,
'date_format' => 'Y-m-d H:i',
'models' => [
'monitored_scheduled_task' => App\Models\MonitoredScheduledTask::class,
'monitored_scheduled_log_item' => App\Models\MonitoredScheduledTaskLogItem::class,
],
'oh_dear' => [
'api_token' => env('OH_DEAR_API_TOKEN', ''),
'monitor_id' => env('OH_DEAR_MONITOR_ID'),
'queue' => env('OH_DEAR_QUEUE', 'oh-dear-pings'),
'ping_oh_dear_job' => Spatie\ScheduleMonitor\Jobs\PingOhDearJob::class,
'retry_job_for_minutes' => 10,
'retry_delay_ms' => env('OH_DEAR_RETRY_DELAY_MS', 5_000),
'silence_ping_oh_dear_job_in_horizon' => true,
'send_starting_ping' => env('OH_DEAR_SEND_STARTING_PING', false),
'grace_time_in_minutes' => 10,
'endpoint_url' => env('OH_DEAR_PING_ENDPOINT_URL'),
'api_url' => env('OH_DEAR_API_URL', 'https://ohdear.app/api/'),
'debug_logging' => env('OH_DEAR_DEBUG_LOGGING', false),
],
];