spatie/laravel-slack-alerts
Send Slack alerts from Laravel in one line. Configure a Slack Incoming Webhook via env or config, then dispatch messages through a queued job so your app won’t fail if Slack is unavailable. Great for notifying you about noteworthy events.
sync driver, but this risks blocking requests.SlackAlert::fake()), simplifying CI/CD pipelines.SubscriberCreated).composer require spatie/laravel-slack-alerts
php artisan vendor:publish --provider="Spatie\SlackAlerts\SlackAlertsServiceProvider"
SLACK_WEBHOOK_URL (or SLACK_APP_TOKEN) in .env.config/slack-alerts.php (e.g., default channel, message formatting).php artisan queue:work
SlackAlert::message("New user registered: {$user->email}");
event(new UserRegistered($user)); // Dispatches SlackAlertJob
curl for HTTP requests (standard in Laravel).database driver.config/slack-alerts.php reduces drift risk.failed_jobs table if using database queue).| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Slack webhook down | Alerts lost | Fallback to email/SMS, retry logic |
| Queue worker crashes | Alerts delayed/failed | Supervisor/Process Manager (e.g., PM2) |
| Slack rate limits exceeded | Alerts rejected | Exponential backoff, batching |
| Invalid Slack token | All alerts fail | Monitor failed_jobs table |
| Large payloads (>4MB) | Slack rejects message | Chunk data or use file uploads |
How can I help you explore Laravel packages today?