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

zackaj/laravel-debounce

Debounce Laravel jobs, notifications, and (Laravel 11+) artisan commands to prevent spam and reduce queue load. Uses unique locks and caching to delay execution until activity stops. Tracks each request occurrence with reports including IP and authenticated user.

View on GitHub
Deep Wiki
Context7

Debounce jobs ,notifications and artisan commands.

Frequently asked questions about Laravel Debounce
How do I debounce a Laravel job to prevent duplicate queue processing?
Extend the `DebounceJob` class in your job and use the `debounce()` facade or method to set a delay (e.g., `Debounce::job($job, 10)`). The package ensures only one instance runs within the interval using atomic locks and caching.
Does this package work with Laravel notifications?
Yes, extend the `DebounceNotification` class and use the `debounce()` method to delay notifications. It tracks occurrences and prevents spamming users with repeated alerts.
What Laravel versions are supported, and is CLI debouncing available?
The package supports Laravel 11+ for all features, including CLI debouncing for Artisan commands. For Laravel <11, only jobs and notifications are supported.
How does report tracking work, and can I access historical data?
Report tracking logs every occurrence with IP, user, and metadata in the cache. Use `Debounce::report()` to retrieve data, but note cache flushes will clear historical records.
What cache driver is recommended for production?
Redis is recommended for atomic locks and performance. Database drivers work but may introduce latency. Ensure your cache driver is configured in Laravel’s `.env` file.
Can I customize the debounce interval dynamically?
Yes, pass a custom delay (in seconds) to `debounce()` or override the default via configuration. For dynamic intervals, use the `overrideTimestamp()` method.
How do I disable debouncing for testing or CI/CD?
Set the environment variable `LARAVEL_DEBOUNCE_ENABLED=false` to bypass debouncing entirely. This is useful for testing or when immediate execution is required.
Are there alternatives to this package for debouncing Laravel jobs?
Alternatives include custom queue listeners or packages like `spatie/laravel-queue-scheduler`, but this package offers built-in reporting, hooks, and CLI support for Laravel 11+.
How do I debounce an Artisan command in Laravel 11+?
Extend `DebounceCommand` and use the `debounce()` method in your command’s logic. The package provides a `debounce:command` Artisan command for ad-hoc debouncing.
What happens if the cache fails during debouncing?
If the cache driver fails, atomic locks may not work, leading to potential duplicate executions. Monitor cache health and consider fallback strategies like database locks for critical tasks.
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.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport