A simple solution would be to create a public property. Each time you send, put a timestamp in the property that is 6 seconds in the future.
In both the front end and the backend, disable sending until this time is in the past.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I have a newsletter livewire component which accepts an email and do create/read operation.
I would like to add a rate limit to this component. That is, allow users to submit the newsletter form 10 times per minute.
I am able to achieve this by setting 'middleware_group' => ['web', 'throttle:10,1'], in config/livewire.php. But this will apply to every livewire calls. I do not want that.
And since this is not directly called from a route, in such case I would have simply added rate limit from the web.php itself, I'm not sure how to add to a livewire component only.
@snapey's method is unfortunately insecure. Since public properties are mutable from the frontend on demand, an attacker could simply alter the timestamp in this property and bypass the "rate limit".
I've just released a new package that allows you to rate limit specific Livewire actions https://github.com/danharrin/livewire-rate-limiting - hope it solves your problem!
Please or to participate in this conversation.