Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

laravel rate limit

use IlluminateSupportFacadesRateLimiter;
 
$executed = RateLimiter::attempt(
    'send-message:'.$user->id,
    $perMinute = 5,
    function() {
        // Send message...
    }
);
 
if (!$executed) {
  return 'Too many messages sent!';
}
 
PREVIOUS NEXT
Tagged: #laravel #rate #limit
ADD COMMENT
Topic
Name
2+6 =