Nextcloud PHP API (master)

ILimiter

Programmatic rate limiter for web requests that are not handled by an app framework controller

Tags
see
AnonRateLimit
see
UserRateLimit
since
28.0.0

Table of Contents

Methods

registerAnonRequest()  : void
Registers attempt for an anonymous request
registerUserRequest()  : void
Registers attempt for an authenticated request

Methods

registerAnonRequest()

Registers attempt for an anonymous request

public registerAnonRequest(string $identifier, int $anonLimit, int $anonPeriod, string $ip) : void
Parameters
$identifier : string
$anonLimit : int
$anonPeriod : int

in seconds

$ip : string
Tags
throws
IRateLimitExceededException

if limits are reached, which should cause a HTTP 429 response

since
28.0.0

registerUserRequest()

Registers attempt for an authenticated request

public registerUserRequest(string $identifier, int $userLimit, int $userPeriod, IUser $user) : void
Parameters
$identifier : string
$userLimit : int
$userPeriod : int

in seconds

$user : IUser

the acting user

Tags
throws
IRateLimitExceededException

if limits are reached, which should cause a HTTP 429 response

since
28.0.0

        
On this page

Search results