Neuron-PHP

RateLimitConfig
in package

Configuration for rate limiting.

Manages rate limit settings with support for environment variables using flat configuration structure (category_name pattern).

Table of Contents

Properties

$_settings  : array<string|int, mixed>

Methods

__construct()  : mixed
fromSettings()  : self
Create configuration from settings source.
getBurstSize()  : int
getFilePath()  : string
getKeyPrefix()  : string
getLimit()  : int
getRedisAuth()  : string|null
getRedisConfig()  : array<string|int, mixed>
Get Redis configuration as array.
getRedisDatabase()  : int
getRedisHost()  : string
getRedisPersistent()  : bool
getRedisPort()  : int
getRedisPrefix()  : string
getRedisTimeout()  : float
getStorage()  : string
getWindow()  : int
isEnabled()  : bool
toArray()  : array<string|int, mixed>
Get all settings as array.

Properties

Methods

__construct()

public __construct([array<string|int, mixed> $settings = [] ]) : mixed
Parameters
$settings : array<string|int, mixed> = []

Configuration settings

fromSettings()

Create configuration from settings source.

public static fromSettings(ISettingSource $source[, string $category = 'rate_limit' ]) : self
Parameters
$source : ISettingSource
$category : string = 'rate_limit'

Category to read settings from (default: 'rate_limit')

Return values
self

getBurstSize()

public getBurstSize() : int
Return values
int

Burst size for token bucket algorithm

getFilePath()

public getFilePath() : string
Return values
string

File storage path

getKeyPrefix()

public getKeyPrefix() : string
Return values
string

Key prefix for storage

getLimit()

public getLimit() : int
Return values
int

Maximum requests allowed

getRedisAuth()

public getRedisAuth() : string|null
Return values
string|null

Redis authentication password

getRedisConfig()

Get Redis configuration as array.

public getRedisConfig() : array<string|int, mixed>
Return values
array<string|int, mixed>

getRedisDatabase()

public getRedisDatabase() : int
Return values
int

Redis database number

getRedisHost()

public getRedisHost() : string
Return values
string

Redis host

getRedisPersistent()

public getRedisPersistent() : bool
Return values
bool

Use persistent Redis connections

getRedisPort()

public getRedisPort() : int
Return values
int

Redis port

getRedisPrefix()

public getRedisPrefix() : string
Return values
string

Redis key prefix

getRedisTimeout()

public getRedisTimeout() : float
Return values
float

Redis connection timeout

getStorage()

public getStorage() : string
Return values
string

Storage type (redis, file, memory)

getWindow()

public getWindow() : int
Return values
int

Time window in seconds

toArray()

Get all settings as array.

public toArray() : array<string|int, mixed>
Return values
array<string|int, mixed>

        
On this page

Search results