The constructor

$detect = new MobileDetect(Cache $cache = null, array $config = [])

The constructor can receive an optional cache class compatible with Psr\SimpleCache\CacheInterface

The constructor can also receive optional $config variables as follows:

Variable nameDefault valueDescription

autoInitOfHttpHeaders

true

Auto-initialization on HTTP headers from $_SERVER['HTTP...']. Disable this if you're going for performance and you want to manually set the User-Agent via $detect->setUserAgent(...)

maximumUserAgentLength

500

Maximum HTTP User-Agent value allowed.

Last updated