Weave Code
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 Debounce Laravel Package

zackaj/laravel-debounce

Debounce Laravel jobs, notifications, and (Laravel 11+) Artisan commands to prevent spamming users and queues. Uses unique job locks + cache to delay execution until activity stops. Tracks each occurrence with request metadata (IP, user) and provides reporting.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Reducing Queue Spam: Mitigate excessive job/notification firing (e.g., real-time events like file uploads, notifications, or CLI commands) by consolidating duplicate operations into a single execution within a configurable delay window.
  • User Experience Optimization: Prevent notification fatigue or redundant actions (e.g., bulk notifications for file uploads) by debouncing triggers (e.g., "show 'X new files' only once every 5 seconds").
  • Cost Efficiency: Lower queue processing costs by reducing redundant job executions (e.g., analytics events, webhooks, or background tasks).
  • Roadmap for Scalability: Enable controlled throttling for high-frequency operations (e.g., API rate limits, cron jobs, or user activity tracking) without custom middleware or queue listeners.
  • Build vs. Buy: Avoid reinventing debounce logic (e.g., custom cache locks, timestamp tracking) by leveraging a battle-tested package with built-in reporting and hooks.
  • Use Cases:
    • Notifications: Debounce bulk notifications (e.g., "New messages" alerts) to avoid spamming users.
    • Jobs: Consolidate duplicate jobs (e.g., analytics events, webhook retries) triggered by rapid user actions.
    • CLI Commands: Throttle scheduled commands (e.g., app:cleanup) to avoid overlapping executions.
    • Reporting: Track debounce occurrences (IP, user, timestamps) for debugging or analytics.

When to Consider This Package

  • Adopt if:
    • Your app suffers from queue spam (e.g., rapid-fire jobs/notifications from user interactions).
    • You need simple debouncing without complex caching or lock implementations.
    • You want built-in reporting (IP/user tracking) for debugging or auditing.
    • Your Laravel version is 11+ (for CLI debounce) or 10+ (for jobs/notifications).
    • You’re using Laravel’s cache driver (supports atomic locks).
  • Look elsewhere if:
    • You need distributed debouncing (multi-server environments; this uses local cache).
    • You require sub-second granularity (this uses whole-second delays).
    • Your use case involves non-Laravel components (e.g., Symfony, Node.js).
    • You need persistent debounce state across cache flushes (reports are cache-dependent).
    • You’re on Laravel <10 (CLI debounce unsupported).

How to Pitch It (Stakeholders)

For Executives: "This package lets us reduce queue noise by consolidating duplicate jobs/notifications into single executions, cutting unnecessary processing costs and improving user experience. For example, instead of sending 10 'new file' notifications in 5 seconds, we’ll send just one—saving queue resources and avoiding user fatigue. It’s turnkey with built-in tracking for debugging, and works seamlessly with our existing Laravel setup."

For Engineers: *"Laravel-debounce provides a clean facade/API to debounce jobs, notifications, and CLI commands using Laravel’s cache locks. Key benefits:

  • Zero setup for basic use (just wrap your job/notification with Debounce::job() or Debounce::notification()).
  • Reporting: Track occurrences (IP, user, timestamps) via $debounceable->getReport().
  • Hooks: Run logic before/after debounced execution (e.g., logging, analytics).
  • CLI Support: Debounce Artisan commands directly (Laravel 11+).
  • Configurable: Toggle globally via .env or per-test. Tradeoff: Reports are cache-dependent (lost on flush), but ideal for most use cases. Example: Debounce a 'file uploaded' notification with a 5-second delay per user to avoid spamming."*
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.
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament
leek/filament-subtenant-scope
anil/file-picker
broqit/fields-ai