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
Request Lock Bundle

Request Lock Bundle Laravel Package

rsumka/request-lock-bundle

A Symfony/PHP bundle that adds request locking to prevent duplicate or concurrent execution of routes and actions. Configure locks per request to avoid race conditions, double submits, and overlapping jobs while keeping handlers safe and repeatable.

View on GitHub
Deep Wiki
Context7

At a glance

Frequently asked questions about Request Lock Bundle
What is rsumka/request-lock-bundle used for?
It is a lightweight request-locking package for preventing duplicate concurrent execution in PHP applications. It uses key-based locks to serialize identical requests such as double form submissions, rapid API retries, and overlapping cron jobs. The goal is to reduce race conditions, duplicated records, and redundant resource usage.
How do I install rsumka/request-lock-bundle?
Install it with Composer using the package name rsumka/request-lock-bundle. The overview describes minimal configuration and framework-native middleware integration, so after installation you register or configure the lock middleware in your request pipeline. Check the repository README for exact service registration and configuration steps for your framework.
Does rsumka/request-lock-bundle work with Laravel?
The package is described as a Symfony/PHP bundle, and the provided overview does not list Laravel-specific middleware registration or Laravel version support. Laravel developers should review the repository and test integration in a staging application before using it in production. If Laravel-native support is required, verify current compatibility or consider a Laravel-specific request-lock alternative.
How does key-based locking prevent duplicate form submissions?
Each incoming request is associated with a lock key that identifies the logical operation, such as a form submission or API action. If a duplicate request arrives while the original holds the lock, the package blocks it or returns a duplicate response until the first request completes. This serializes identical work and prevents two handlers from creating the same record or side effect.
Can I configure lock timeouts and custom lock lifetimes?
Yes. The package advertises configurable lock timeouts and custom lock lifetimes as core features. You can tune how long a lock is held so that slow or failed requests do not block duplicates indefinitely. Exact configuration keys should be confirmed in the repository documentation for your framework.
What is the difference between blocking and non-blocking duplicate request behavior?
Blocking behavior makes a duplicate request wait until the original lock is released, which is useful when the duplicate should eventually execute or return the original result. Non-blocking behavior rejects or short-circuits the duplicate immediately, which suits rapid retries and double-submit protection where a duplicate should not run. The package supports both modes so you can match the behavior to the route or action.
How do I integrate request locking into middleware?
The package provides middleware integration so locking can be applied in the existing request pipeline. You typically register the middleware and configure which requests or routes should use key-based locking. This keeps locking logic out of controllers and makes duplicate-request protection consistent across handlers.
Does it help with overlapping cron jobs and rapid API retries?
Yes, the overview lists overlapping cron jobs and rapid API retries as intended use cases. A shared lock key can ensure only one instance of a job or retried API operation runs at a time. That reduces duplicated records and redundant resource usage caused by concurrent execution.
What are alternatives to rsumka/request-lock-bundle for request locking?
Alternatives include framework-native locks, cache-based atomic locks, database advisory locks, and rate-limiting or idempotency middleware. The best choice depends on whether you need blocking behavior, custom lock lifetimes, and middleware-level integration. rsumka/request-lock-bundle is positioned as a lightweight option with key-based locking and minimal configuration.
How should I test request locking before production?
Test with concurrent requests that share the same lock key, including double submits, retries, and overlapping job runs. Verify both blocking and non-blocking behavior, lock timeout handling, and what happens when the original request fails or exceeds its lifetime. Run these tests in a staging environment that matches your production cache or lock storage.
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.
elsayed85/laravel-api-exceptions
ouhssini/laravel-demo-mode
daworks/ncloud-outbound-mailer-driver
gp247/cms
ignibyte/aic-gates
nexa-merchant/blog
novasa/laravel-language-center
opencage/geocode
adolfoholzer/parameters
livenetworks/ln-starter
shitoudev/permissionmanager
johannesclimacus/laravel-tui
hocvt/seotools
vitalybaev/sypexgeo
amphibee/themosis-ignition
gito-me/fast-excel
frankyso/laravel-ipaymu
geolize-studio/laravel-chile
boomerangui/chat
cgv/localized-resource