errly / laravel-errly
Error monitoring with Slack notifications and encrypted alerts in the Errly app, plus scheduler and queue heartbeats, for Laravel applications
Fund package maintenance!
Requires
- php: ^8.2
- bacon/bacon-qr-code: ^3.0
- illuminate/contracts: ^12.0 || ^13.0
- laravel/slack-notification-channel: ^3.0
- spatie/laravel-package-tools: ^1.16
Requires (Dev)
- larastan/larastan: ^3.0
- laravel/pint: ^1.14
- nunomaduro/collision: ^8.1.1 || ^9.0
- orchestra/testbench: ^10.0 || ^11.0
- pestphp/pest: ^3.8.5 || ^4.0
- pestphp/pest-plugin-arch: ^3.0 || ^4.0
- pestphp/pest-plugin-laravel: ^3.0 || ^4.0
- phpstan/extension-installer: ^1.3 || ^2.0
- phpstan/phpstan-deprecation-rules: ^1.1 || ^2.0
- phpstan/phpstan-phpunit: ^1.3 || ^2.0
Suggests
- ext-sodium: Required by the Errly app channel to encrypt reports. Included in standard PHP builds.
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-11-26 09:41:48 UTC
README
Error alerts and heartbeat monitoring for Laravel 12 and 13 on PHP 8.2 through 8.5.
Errly alerts you when your application throws an error that matters, and pings an outside monitor so you hear about it when the scheduler or a queue worker stops. Alerts go to Slack, to the Errly app on iPhone and Mac, or to both. Setup is one line in bootstrap/app.php, plus a Slack webhook or php artisan errly:pair.
- Slack alerts with the request, user, server and stack trace
- Errly app alerts on iPhone and Mac, encrypted in your app so the service that delivers them cannot read them
- Filtering that skips 404s, validation and auth errors, and rate limits the rest
- Heartbeats that alert you when the scheduler or a worker stops, even when nothing throws
- Redaction of passwords, tokens and other sensitive fields
- Free and open source under the MIT license
Error notifications go to Slack and the Errly app. Use either one or both. Discord, Teams and email support are planned, and you can add your own channel. Heartbeats support Healthchecks.io (hosted or self-hosted), and other monitors can be plugged in.
Requirements
- PHP 8.2+
- Laravel 12+
- Somewhere to send alerts, one or both of:
- Slack: a workspace with an incoming webhook
- Errly app: the app on an iPhone or Mac, and the PHP
sodiumextension (included in standard PHP builds)
- Optional: a Healthchecks.io account for heartbeats
Quick Start
1. Install
composer require errly/laravel-errly php artisan vendor:publish --tag=laravel-errly-config
2. Set up Slack, the Errly app, or both
Slack
- Go to Slack API Apps
- Create new app → "From scratch"
- Enable "Incoming Webhooks"
- Add a webhook to the channel you want alerts in
- Copy the webhook URL into
.env:
ERRLY_SLACK_WEBHOOK_URL=https://hooks.slack.com/services/YOUR/WEBHOOK/URL
Errly app
php artisan errly:pair
Scan the QR code it draws with the Errly app. See Errly app for the details.
ERRLY_CHANNELS decides where alerts go. It defaults to slack, and errly:pair adds app, so with a Slack webhook set both get every alert. For the app alone, set ERRLY_CHANNELS=app.
3. Register the exception handler
// bootstrap/app.php use Errly\LaravelErrly\ErrlyServiceProvider; return Application::configure(basePath: dirname(__DIR__)) // ... other configuration ->withExceptions(function (Exceptions $exceptions): void { // Only configure Errly if the package is installed if (class_exists(ErrlyServiceProvider::class)) { ErrlyServiceProvider::configureExceptions($exceptions); } }) ->create();
4. Send a test alert
php artisan errly:test
A test alert should appear in Slack, the Errly app, or both.
What an alert looks like
🚨 **CRITICAL Error in MyApp Production**
🔍 Error Details
Exception: Illuminate\Database\QueryException
Message: SQLSTATE[42S02]: Base table or view not found
File: /app/Http/Controllers/UserController.php
Line: 42
URL: https://myapp.com/users/123
Method: GET
User: john@example.com (ID: 1234)
Environment: production
Server: web-01
📋 Stack Trace
#0 /app/Http/Controllers/UserController.php(42): ...
#1 /app/vendor/laravel/framework/src/...
[... truncated]
Each alert includes:
- Request details - URL, method, IP, user agent
- User information - ID, email, name (if authenticated)
- Server information - hostname, environment
- Stack trace - with a configurable length
Errors are given a severity:
- CRITICAL - database errors, fatal errors, parse errors
- HIGH - HTTP 500+ errors
- MEDIUM - general exceptions, runtime errors
Configuration
The defaults work without changes. Everything below can be adjusted in config/errly.php:
// config/errly.php return [ 'enabled' => env('ERRLY_ENABLED', true), // Where reports go. Each channel is tried on its own. 'channels' => explode(',', env('ERRLY_CHANNELS', 'slack')), 'slack' => [ 'webhook_url' => env('ERRLY_SLACK_WEBHOOK_URL'), 'channel' => env('ERRLY_SLACK_CHANNEL', '#errors'), 'username' => env('ERRLY_SLACK_USERNAME', 'Laravel Errly'), 'emoji' => env('ERRLY_SLACK_EMOJI', '🚨'), ], 'filters' => [ 'environments' => [ 'enabled' => env('ERRLY_FILTER_ENVIRONMENTS', true), 'allowed' => explode(',', env('ERRLY_ALLOWED_ENVIRONMENTS', 'production,staging')), ], // Automatically ignores noise like 404s, validation errors 'ignored_exceptions' => [ \Illuminate\Validation\ValidationException::class, \Symfony\Component\HttpKernel\Exception\NotFoundHttpException::class, // ... more ], // High-priority alerts for critical errors 'critical_exceptions' => [ \Illuminate\Database\QueryException::class, \ErrorException::class, // ... more ], ], 'rate_limiting' => [ 'enabled' => env('ERRLY_RATE_LIMITING', true), 'max_per_minute' => env('ERRLY_MAX_PER_MINUTE', 10), ], ];
The same settings through .env:
# Basic Setup ERRLY_ENABLED=true ERRLY_SLACK_WEBHOOK_URL=https://hooks.slack.com/services/T.../B.../xxx # Advanced Configuration ERRLY_CHANNELS=slack ERRLY_SLACK_CHANNEL=#production-errors ERRLY_SLACK_USERNAME="MyApp Alerts" ERRLY_SLACK_EMOJI=⚠️ # Environment Filtering (only report in production) ERRLY_FILTER_ENVIRONMENTS=true ERRLY_ALLOWED_ENVIRONMENTS=production,staging # Rate Limiting (prevent spam) ERRLY_RATE_LIMITING=true ERRLY_MAX_PER_MINUTE=5 # Custom App Name ERRLY_APP_NAME="My Awesome App"
Filtering
These are ignored by default:
- 404 errors - page not found
- Validation errors - form validation failures
- Auth errors - login failures
- Rate limiting errors - too many requests
Sensitive data
Errly redacts passwords, strips authorization headers, and sanitizes nested request payloads. Add your own fields to the list:
// Sensitive fields are automatically redacted 'sensitive_fields' => [ 'password', 'password_confirmation', 'token', 'api_key', 'credit_card', 'ssn', ],
Database errors are posted with the failed query's placeholders (?) instead of its values, and values the database repeats in its error (such as a duplicate key) show as [REDACTED]. To post the values, set ERRLY_REDACT_SQL_BINDINGS=false.
Performance
- Rate limiting - prevents notification spam
- Filtering - only processes errors that matter
- Low memory use - lightweight error context collection
Channels
Errly builds each error report once - severity, redacted message, fields and stack trace - and hands it to every channel in ERRLY_CHANNELS (default slack). A channel that fails is logged and the others still send.
Channels are resolved with Laravel's Manager, so you can add your own from a service provider:
use Errly\LaravelErrly\Channels\Channel; use Errly\LaravelErrly\Channels\ChannelManager; use Errly\LaravelErrly\ErrorReport; app(ChannelManager::class)->extend('my-channel', fn () => new class implements Channel { public function send(ErrorReport $report): void { // $report->severity, $report->message, $report->fields, $report->trace } });
Then set ERRLY_CHANNELS=slack,my-channel.
Errly app (iPhone and Mac)
Errly can also send alerts to the Errly app as encrypted push notifications. Reports are encrypted in your Laravel app with a key that only your app and your paired devices hold; the Errly service stores and forwards ciphertext and never sees the key.
Pair a device
php artisan errly:pair
The first run creates a channel on the Errly service and writes ERRLY_APP_CHANNEL, ERRLY_APP_SEND_TOKEN and a new ERRLY_APP_KEY to .env. It also adds app to ERRLY_CHANNELS. Then it draws a QR code in the terminal: scan it with the Errly app. The code works once and expires after 10 minutes. Run the command again to pair another device; a device added after the first has to be approved from one already paired.
On a Mac, run php artisan errly:pair --link and paste the printed link into the app. The QR code and the link hold the channel key, so do not save or share them.
If your config is cached, run php artisan config:clear first: errly:pair will not create or rotate a channel while the config is cached. Run php artisan config:cache after pairing.
The app channel needs the PHP sodium extension, which is included in standard PHP builds. Slack does not need it. Without it, app reports are not sent and the reason is logged.
Manage devices
php artisan errly:devices # list paired devices php artisan errly:devices --revoke=<id> # remove one php artisan errly:pair --rotate # new send token and key; removes every device
Rotate if .env may have leaked, then pair your devices again.
Options
ERRLY_CHANNELS=slack,app ERRLY_APP_URL=https://errlyservice.tallbottech.com # Leave the signed-in user and the request URL out of app reports ERRLY_APP_INCLUDE_PERSONAL_DATA=false
Each report is sent with a 5 second timeout. If the service does not answer, or answers with a server error or a rate limit, one retry is queued on your default queue connection (on the sync driver it runs straight away). Other failures are logged and never thrown into your app. When the rate limiter drops repeats of an error, the next report of that error carries the count.
The service deletes a channel that has had no paired device for a day, or no use for 30 days. Reports to it are then logged with a warning, and php artisan errly:pair offers to make a new channel.
Manual error reporting
use Errly\LaravelErrly\Facades\Errly; try { // Risky operation $result = $this->processPayment($amount); } catch (PaymentException $e) { // Report with custom context Errly::report($e, [ 'user_id' => auth()->id(), 'amount' => $amount, 'payment_method' => 'stripe', ]); // Handle gracefully return response()->json(['error' => 'Payment failed'], 500); }
Heartbeat Monitoring
An exception alert cannot tell you that nothing is running. If the scheduler or a queue worker dies, no error is thrown and no alert is sent. Heartbeats cover that gap: every minute Errly pings an outside monitor, and the monitor alerts you when the pings stop.
Heartbeats are off until you configure a check, so existing installs are unaffected. They need the scheduler running (schedule:run from cron, or schedule:work).
What gets pinged
| Heartbeat | How it is sent | Stops when |
|---|---|---|
| Scheduler | Inline, inside the scheduler | The scheduler stops running |
| Queue | A small job pushed to that queue | No worker is draining that queue |
A queued heartbeat is tried once and never reported as a failure, so an unreachable monitor does not fill failed_jobs or Slack. While a worker is down, only one heartbeat per queue waits in the queue.
Things to know:
- Maintenance mode - Laravel does not run scheduled tasks while the app is down (
php artisan down), so every heartbeat stops and the monitor alerts. Pause the checks in your monitor for long maintenance windows. syncqueue driver - jobs run straight away inside the scheduler, so a queue heartbeat would only prove the scheduler ran. Point queue heartbeats at a real queue connection.- Unique lock - the one-waiting-heartbeat limit uses your default cache store. With several servers, that store must be shared (Redis, database, Memcached).
- Monitoring tools - the ping requests bypass Laravel's
Httpclient hooks, so Telescope, Pulse and Nightwatch do not record them or the secret ping URL. The queued heartbeat job is a normal job, so Horizon, Telescope and Nightwatch will show one per queue per minute. - Keep checks secret - anyone with a ping URL, UUID or ping key can ping your checks and hide an outage. Keep them in
.env, not in committed config.
Setup with Healthchecks.io
- Create one check per heartbeat in Healthchecks.io, with a period of 1 minute and a grace time that suits you (for example 5 minutes).
- Add them to
.env. A check can be a full ping URL, a check UUID, or a slug:
# Full URL or UUID ERRLY_HEARTBEAT_SCHEDULER=https://hc-ping.com/your-scheduler-uuid ERRLY_HEARTBEAT_QUEUE_DEFAULT=your-default-queue-uuid # Or slugs, with the project's ping key ERRLY_HEALTHCHECKS_PING_KEY=your-project-ping-key ERRLY_HEARTBEAT_SCHEDULER=myapp-scheduler ERRLY_HEARTBEAT_QUEUE_DEFAULT=myapp-queue-default
- Check each one reaches the monitor:
php artisan errly:heartbeat-test
This pings straight from the command, so it proves the checks exist, not that your workers run. Leave a check blank in local and staging to keep it off there.
More queues
ERRLY_HEARTBEAT_QUEUE_DEFAULT covers the connection's default queue. Publish the config and add any other queue your workers listen on:
'heartbeat' => [ 'queues' => [ 'default' => env('ERRLY_HEARTBEAT_QUEUE_DEFAULT'), 'emails' => env('ERRLY_HEARTBEAT_QUEUE_EMAILS'), ], // Use a connection other than the default one 'queue_connection' => env('ERRLY_HEARTBEAT_QUEUE_CONNECTION'), ],
Heartbeat options
ERRLY_HEARTBEAT_ENABLED=true # Heartbeats only (ERRLY_ENABLED=false also stops them) ERRLY_HEARTBEAT_CLIENT=healthchecks # Which monitor to ping ERRLY_HEALTHCHECKS_URL=https://hc-ping.com # Change for self-hosted Healthchecks ERRLY_HEALTHCHECKS_TIMEOUT=5 # Seconds per ping ERRLY_HEALTHCHECKS_ATTEMPTS=1 # Tries per ping (retries 5xx, 429 and network errors only) ERRLY_HEALTHCHECKS_AUTO_PROVISION=false # Create missing slug checks on first ping
Auto-provisioning: Healthchecks.io gives a check created this way a period of 1 day and a grace time of 1 hour, and the period cannot be set from the ping. Change it to 1 minute in the dashboard, or a dead worker can go unnoticed for about a day.
Other monitors
Heartbeat clients are resolved with Laravel's Manager, so you can add your own from a service provider:
use Errly\LaravelErrly\Heartbeat\HeartbeatClient; use Errly\LaravelErrly\Heartbeat\HeartbeatManager; app(HeartbeatManager::class)->extend('my-monitor', fn () => new class implements HeartbeatClient { public function ping(string $check): void { // Send the ping. Throw a HeartbeatException if it was not recorded. } });
Then set ERRLY_HEARTBEAT_CLIENT=my-monitor.
Monitoring a single scheduled task? Laravel already has
->pingOnSuccess($url)and->pingOnFailure($url)on scheduled events. Errly's heartbeats are for the scheduler and workers as a whole.
Testing
# Send a general test error to your channels php artisan errly:test # Test specific error types php artisan errly:test critical # database, fatal errors php artisan errly:test database php artisan errly:test validation # should be ignored php artisan errly:test custom # Test your heartbeat checks php artisan errly:heartbeat-test
Troubleshooting
Not receiving Slack notifications?
1. Check your webhook URL
# Test with curl curl -X POST -H 'Content-type: application/json' \ --data '{"text":"Test from curl"}' \ YOUR_WEBHOOK_URL
2. Verify configuration
php artisan tinker >>> config('errly.enabled') >>> config('errly.slack.webhook_url')
3. Check Laravel logs
tail -f storage/logs/laravel.log
4. Test manually
use Errly\LaravelErrly\Facades\Errly; Errly::report(new Exception('Manual test'));
Not receiving alerts in the Errly app?
- Check
appis inERRLY_CHANNELS, and runphp artisan errly:devicesto see the paired devices. - Look for lines starting with
Errly:instorage/logs/laravel.log. They say why a report was not sent. - Repeats of one error are pushed on the 1st, 10th and 100th time; the others are only listed in the app. When testing, run another
errly:testtype or resolve the alert in the app first.
Too many notifications?
Enable rate limiting:
ERRLY_RATE_LIMITING=true ERRLY_MAX_PER_MINUTE=5
Notifications in development?
Use environment filtering:
ERRLY_FILTER_ENVIRONMENTS=true ERRLY_ALLOWED_ENVIRONMENTS=production,staging
Heartbeat check not receiving pings?
Run php artisan errly:heartbeat-test and read the reason next to each FAILED line:
OK (not found)- the UUID does not match a check in Healthchecks.io404 not found- the slug does not match a check (or turn on auto-provisioning)409 ambiguous slug- two checks in the project share that slug
If the test passes but a queue check still goes down, no worker is listening on that queue, or schedule:run is not running.
On cPanel/CloudLinux, /usr/bin/php in cron can be the CGI build: its output starts with Content-type: text/html, and php -v shows cgi-fcgi. Point cron at the command-line binary instead:
cd /path/to/app && /usr/local/bin/php artisan schedule:run
errly:heartbeat-test prints a warning when it runs under a PHP build other than the CLI.
Contributing
Contributions are welcome. See CONTRIBUTING.md for details.
git clone https://github.com/jeromecoloma/laravel-errly.git cd laravel-errly composer install composer test # Run test suite composer analyse # Static analysis composer format # Code formatting
See CHANGELOG.md for recent changes.
License
Laravel Errly is open-sourced software licensed under the MIT license.
Credits
- Jerome Coloma - Creator and maintainer
- Laravel Community - Inspiration and feedback
- Spatie - Package development tools
If Errly helps you, star the repo, share it with #LaravelErrly, or join the discussion in Issues.
Star on GitHub • View on Packagist • Report Issues • Discussions