Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Discord Alerts Laravel Package

spatie/laravel-discord-alerts

Quickly send alerts to Discord from your Laravel app using a simple facade. Messages are dispatched via a queued job, so your app keeps running even if Discord is down. Just set a webhook URL and start notifying yourself of noteworthy events.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture fit

  • This is a thin, single-responsibility adapter: a facade (DiscordAlert::message()) that serialises a payload and dispatches SendToDiscordChannelJob to a queue. It is not a notification framework, not a Discord SDK, and not an incident-management system. Scope it accordingly.
  • Fits cleanly into a standard Laravel app: service provider + publishable config + env-driven webhook (DISCORD_ALERT_WEBHOOK). No database migrations, no schema changes, no long-running daemons.
  • The genuinely valuable architectural decision is that the HTTP call is always queued. That decouples alert emission from Discord availability, which is the primary reason to prefer this over a raw Http::post() in a controller or model observer.
  • It overlaps with Laravel's native notification system. For anything user-facing, the native Notification + Notifiable abstraction should win; this package is for internal/ops signalling only.

Integration feasibility

  • Very high. Install is one Composer command plus one env var. A developer can emit the first alert in under an hour.
  • Feature surface is narrow but sufficient for ops use cases: plain messages, embeds (title/description/colour/author, multiple per message), attachments (attach() path-based, attachData() in-memory), multi-webhook routing via to(), per-message username/avatar/TTS overrides, and delayMinutes() / delayHours() deferral.
  • Delayed sends are implemented by stacking queue delay onto the job; they are not durable scheduled reminders. Treat delay as a queued deferral, not a cron substitute — a queue flush loses the alert.

Technical risk

  • Adoption signal is weak: ~157 stars and zero listed dependents. Vendor reputation (Spatie) is strong and CI is credible (tests, PHPStan, php-cs-fixer all green), but this is not a widely exercised package. Do not assume production hardening you have not verified.
  • Delivery semantics are best-effort. Queue retry gives you retries, but there is no idempotency key, no deduplication, no documented circuit breaker, and no documented handling of Discord's HTTP 429 retry_after. A rate-limit storm will show up as failed jobs, not as throttled backoff. This is the single biggest technical risk for high-volume use.
  • Attachments are read at job execution time. The README explicitly warns that attach() path files must still exist when the worker runs, and that cross-machine workers need attachData(). On ephemeral or per-node filesystems this silently produces failed sends. This is an operational trap, not a technical bug.
  • Secrets management. The webhook URL is a bearer credential with post rights to a channel. It lives in env/config and in config:cache. Rotation requires a deploy or config clear — plan a dual-webhook cutover.
  • No documented test double. The README's "Testing" section only runs the package's own suite; it does not document a DiscordAlert::fake()-style assertion helper. Verify this before committing — otherwise alert-emitting code paths will be untested or will hit the network in CI.

Key questions

  1. Which Laravel and PHP versions does composer.json actually constrain? Changelog evidence only confirms Laravel 9 and 10. Confirm 11/12 before assuming a current-stack fit.
  2. Does the job retry on 429/5xx, and does it honour retry_after? Read SendToDiscordChannelJob source.
  3. Is there a fake/assertion helper for tests, and is the transport injected or hard-coded to Http?
  4. What is the expected alert volume per channel per minute versus Discord's per-webhook rate limit (~30 req/min)?
  5. Do queue workers share the filesystem with the web tier? If not, attach() is off-limits.
  6. Is there a business requirement for delivery guarantees, audit trail, or on-call escalation? If yes, this package is one input to that system, not the system.

Integration Approach

Stack fit

  • Assumes a Laravel app with a working queue driver (redis/database/SQS) and a scheduler or worker fleet. If the app runs QUEUE_CONNECTION=sync, the package's core benefit evaporates — the HTTP call becomes synchronous and Discord latency/failures hit the request path. Confirm the driver before adopting.
  • Config supports queue_connection and queue (env-driven, DISCORD_ALERT_QUEUE_CONNECTION / DISCORD_ALERT_QUEUE), so alerts can be isolated onto a dedicated queue rather than competing with business jobs. Use this.

Migration path

  • Greenfield: straightforward — install, configure default webhook, emit from a small number of call sites.
  • Replacing raw Http::post() calls: low-risk mechanical swap. Keep the old call sites behind a thin internal OpsAlert wrapper class that delegates to the facade. That wrapper is the seam that makes the eventual replacement (or a fork) a one-file change.
  • Do not couple domain code directly to Spatie\DiscordAlerts\Facades\DiscordAlert. Every call site should go through your own facade/service so vendor churn, config reshaping, or a switch to a different transport is contained.

Compatibility

  • MIT licence, no copyleft obligations — fine for commercial and closed-source use.
  • Discord webhook API is stable but rate-limited and payload-capped: 2,000 characters of content, 10 embeds per message, 10 files per message, 8MB total attachments unboosted. The package does not validate these; your wrapper should truncate and pre-check.
  • Changelog shows steady Laravel-version tracking (9, then 10) via community PRs. Budget a maintenance task per Laravel major upgrade.

Sequencing

  1. Prove — single internal #ops-test channel, one call site, verify queue dispatch, verify failure behaviour with a deliberately bad URL.
  2. Harden — wrap in an internal service; register a custom job via the job config key to set $tries, $backoff, and $timeout; add logging on failed(); document the secrets/rotation runbook.
  3. Observe — instrument with a counter for emitted vs. failed alerts; confirm failed_jobs is monitored.
  4. Expand — add named webhooks per team (marketing, infra, etc.), route by audience. Keep one channel per team to stay under per-webhook rate limits.
  5. Defer — only then consider attachments and embeds, which carry the file-system and payload-size risks.

Operational Impact

Maintenance

  • Low, with caveats. The package is small and slow-moving; the practical maintenance surface is the Laravel major-upgrade cadence and the queue infrastructure underneath it. Expect one small upgrade task per year plus occasional dependency bumps.
  • Zero dependents means you are effectively a first-wave adopter — you will find the edge cases. Plan for the possibility of pinning a version and carrying a local patch.

Support

  • Community-only: GitHub issues, no vendor SLA, no paid support tier. Spatie's overall track record is good, but this repo's size means issue response is volunteer-paced.
  • Mitigate: fork it into your VCS (it is ~a handful of classes; MIT permits this), or maintain the internal wrapper so you can replace it in an afternoon. Do not let this package become a single point of failure for a critical alerting path.

Scaling

  • The package scales linearly with queue capacity; it does nothing itself to smooth bursts.
  • The binding constraint is Discord's per-webhook rate limit, not your app. Design fan-out accordingly: one webhook per audience, aggregate where possible (one digest message instead of N per-event messages), and use delayMinutes() to spread bursts.
  • Attachments are the expensive path: 8MB cap and files fetched at execution time. Keep attachments to scheduled reports, not per-event alerts.

Failure modes

Failure Symptom Mitigation
Discord down / 5xx Alerts silently queued then failed Configure $tries/$backoff on a custom job; alert on failed_jobs growth
Rate limited (429) Failed jobs, dropped alerts Aggregate messages; one webhook per audience; verify retry_after handling
Worker never running Alerts queue indefinitely, no error Monitor queue depth and worker heartbeats independently of this package
attach() path missing on worker Failed job, no delivery Standardise on attachData(); forbid path-based attach via code review
Webhook rotated/revoked 401/404, all sends fail Dual-webhook cutover; config-cache clear in the deploy; smoke test post-deploy
Secrets in config cache Rotated value not picked up Explicit config:clear step; treat webhook URL as a rotated secret
Channel deleted Silent loss of the alert destination Periodic synthetic heartbeat alert to each channel

Ramp-up

  • For a Laravel-fluent developer: under a day to first working integration, 2–3 days to a hardened one (wrapper, retries, logging, tests, runbook). No new language, framework, or operational tooling to learn.
  • For the wider team: the only institutional knowledge required is "alerts go to Discord via a queue, and a failed job means no alert." That should be written down, plus a documented manual fallback (who to message, where) for when Discord or the queue is unavailable.
  • Onboarding cost is dominated by the secrets runbook and the on-call expectation, not by the code. Treat the runbook as the deliverable and the package as an implementation detail.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
jhaskell13/laraflow
sebastienheyd/boilerplate-media-manager
ccast/tagixo-primix
pretendtrue/laravel-builder
sawmainek/laravel-scout-tntsearch-driver
tomshaw/laravel-calendar-table
dibakar/laravel-ownership
steadrun/laravel-monitor
labyrinthe/connect-laravel
elmogy/layan
drewdan/sentinel-client
dskripchenko/laravel-llm
fatryst/nuonuo
stevenay/myanfont
gmostafa/php-graphql-client
xeviant/paystack
snowsoft/faker
meditationsteps/blogetc
animalyoung/laravel-influxdb
onix-solutions/sms-telera