cronitor / laravel
Laravel integration for Cronitor scheduler provisioning and job telemetry
Requires
- php: ^8.1
- cronitor/cronitor-php: ^1.0
- illuminate/cache: ^10.0|^11.0|^12.0
- illuminate/console: ^10.0|^11.0|^12.0
- illuminate/contracts: ^10.0|^11.0|^12.0
- illuminate/events: ^10.0|^11.0|^12.0
- illuminate/queue: ^10.0|^11.0|^12.0
- illuminate/support: ^10.0|^11.0|^12.0
- psr/log: ^1.1|^2.0|^3.0
Requires (Dev)
- orchestra/testbench: ^8.0|^9.0|^10.0
- phpunit/phpunit: ^10.0|^11.0
This package is not auto-updated.
Last update: 2026-08-26 22:54:45 UTC
README
Laravel integration for Cronitor scheduler provisioning and runtime telemetry.
Installation
composer require cronitor/laravel
Publish config:
php artisan vendor:publish --tag=cronitor-config
What it does
- Provisions monitors from Laravel scheduler definitions at deploy time.
- Sends runtime telemetry for scheduled tasks (
run,complete,fail). - Sends runtime telemetry for queue jobs (
run,complete,fail).
Settings reference
// config/cronitor.php return [ 'enabled' => env('CRONITOR_ENABLED', true), 'api_key' => env('CRONITOR_API_KEY'), 'api_version' => env('CRONITOR_API_VERSION'), 'environment' => env('CRONITOR_ENVIRONMENT'), 'monitor_defaults' => [], 'ignored_jobs' => [], 'ignored_tasks' => [], ];
enabled
- Type:
bool - Default:
true(CRONITOR_ENABLED) - Global on/off switch for the package.
api_key
- Type:
string - Default:
null(CRONITOR_API_KEY) - Required for
cronitor:syncand runtime telemetry pings.
api_version
- Type:
string|null - Default:
null(CRONITOR_API_VERSION) - Optional API version passed to the Cronitor client.
environment
- Type:
string|null - Default:
null(CRONITOR_ENVIRONMENT) - Optional environment tag passed to the Cronitor client.
monitor_defaults
- Type:
array - Default:
[] - Default fields merged into every monitor created by
cronitor:sync. - Common fields:
notify(string[]) notification list keys.group(string) Cronitor group key.
- Reserved fields are ignored from this block:
key,type,name,schedule.
ignored_jobs
- Type:
string[] - Default:
[] - Skip queue telemetry for matching queue raw names or resolved keys.
ignored_tasks
- Type:
string[] - Default:
[] - Skip scheduler sync and scheduler telemetry for matching task summary or key.
Example:
'monitor_defaults' => [ 'notify' => ['devops-alerts'], 'group' => 'platform-jobs', ],
Sync behavior
Sync is a deploy-time operation. It creates/updates Cronitor monitors directly from Schedule::events() so they appear in the dashboard immediately, before first execution. The sync payload includes each task's monitor key, display name, and cron schedule.
Dry run:
php artisan cronitor:sync --dry-run
Apply sync:
php artisan cronitor:sync
Runtime telemetry behavior
Scheduler events
ScheduledTaskStarting->runScheduledTaskFinished->completeScheduledTaskFailed->fail
Queue events
JobProcessing->runJobProcessed->completeJobFailed->fail
Deploy flow (recommended)
- Deploy code with
cronitor/laravelinstalled. - Run
php artisan cronitor:syncduring deploy. - Start/continue scheduler and queue workers. Runtime telemetry updates provisioned monitors.
Docker testing
Run the package tests fully in Docker:
docker build -t cronitor-laravel-test .
docker run --rm cronitor-laravel-test
Custom queue key contract
If your queued object implements Cronitor\Laravel\Contracts\DefinesCronitorKey, that key is used.
use Cronitor\Laravel\Contracts\DefinesCronitorKey; class ShipOrder implements DefinesCronitorKey { public function cronitorKey(): string { return 'ship-order'; } }
Additional docs
docs/architecture.mddocs/rollout-checklist.md