UserAgentService
final class UserAgentService (View source)
Reads and sanitizes the request User-Agent for logging and bot detection.
This service provides methods to safely retrieve and sanitize User-Agent strings for logging purposes, preventing potential security issues such as log injection attacks.
Constants
| private MAX_LENGTH |
|
| private DEFAULT_USER_AGENT |
|
Methods
__construct(array $server)
No description
string
getUserAgent()
Get the User-Agent string safely sanitized for logging
string
getShortUserAgent(int $maxLength = 100)
Get a shortened version of the User-Agent string
string
getBrowserInfo()
Get browser name and version from User-Agent
bool
isBot()
Check if the request is from a bot/crawler
Details
__construct(array $server)
No description
string
getUserAgent()
Get the User-Agent string safely sanitized for logging
string
getShortUserAgent(int $maxLength = 100)
Get a shortened version of the User-Agent string
string
getBrowserInfo()
Get browser name and version from User-Agent
bool
isBot()
Check if the request is from a bot/crawler