Learn how to use Mobile Detect library via composer
composer require mobiledetect/mobiledetectlib
// composer.json{"require": {"mobiledetect/mobiledetectlib":"4.8.09"// Change to the lastest version. }}
// your_script.php// (optional) You're app is probably already using composer autoloader.require__DIR__.'/vendor/autoload.php';// (mandatory)useDetection\MobileDetect;$detect =newMobileDetect();// (optional) By default the Mobile Detect library auto-detects the HTTP headers from $_SERVER global variable.$detect->setUserAgent('Mozilla/5.0 (iPad; CPU OS 14_7 like Mac OS X) ...');// Use whatever methods you want.$isMobile = $detect->isMobile();$isTablet = $detect->isTablet();var_dump($isMobile);var_dump($isTablet);var_dump($detect); // debug