laravel/nightwatch
Official Laravel Nightwatch package that collects application performance metrics and sends them to the hosted Nightwatch monitoring platform, providing Laravel-optimized insights into requests, errors, and overall app health.
NIGHTWATCH_COMMAND_SAMPLE_RATE), allowing selective metric collection to balance overhead and granularity. This aligns with cost-efficient observability for high-traffic applications.composer require laravel/nightwatch.env (e.g., NIGHTWATCH_API_KEY).Nightwatch::ignore()).nightwatch:deploy Artisan command to auto-detect deployments (via NIGHTWATCH_DEPLOY env var), simplifying CI/CD integration.octane:status) to avoid noise, reducing false positives.NIGHTWATCH_COMMAND_SAMPLE_RATE and NIGHTWATCH_SCHEDULED_TASK_SAMPLE_RATE.Nightwatch::digest()).AGENTS.md).octane:status by default).composer.json:
"require": {
"laravel/nightwatch": "^1.28"
}
.env:
NIGHTWATCH_API_KEY=your_key_here
NIGHTWATCH_APP_ID=your_app_id
NIGHTWATCH_COMMAND_SAMPLE_RATE=0.1 # 10% sampling
NIGHTWATCH_SCHEDULED_TASK_SAMPLE_RATE=0.5 # 50% sampling
Nightwatch::ignore('health-check');
nightwatch:deploy Artisan command in CI/CD:
php artisan nightwatch:deploy
NIGHTWATCH_DEPLOY via env vars.| Component | Compatibility | Notes |
|---|---|---|
| Laravel 10–13 | ✅ Full support | Tested in CI (v1.24.0+). |
| PHP 8.1–8.5 | ✅ Supported | PHP 8.5 added in v1.20.0. |
| Octane/Horizon | ✅ Supported | Ignores octane:status by default. |
| Livewire | ✅ Partial (component interactions) | Ignores checksum failures (v1.23.0). |
| Custom Queues/Jobs | ✅ Automatic (if using Laravel’s queue system) | Manual instrumentation needed for non-Laravel queues. |
| Third-Party APIs | ❌ No native support | Use Nightwatch::track() for custom metrics. |
| Multi-Process Apps | ✅ Supported (with config) | Ensure NIGHTWATCH_AGENT_TOKEN is set per worker. |
.env files and document rules in a CONTRIBUTING.md.NIGHTWATCH_DEBUG=true (logs to storage/logs/nightwatch.log).How can I help you explore Laravel packages today?