$detect->getScriptVersion(), // All headers that trigger 'isMobile' to be 'true', // before reaching the User-Agent match detection. 'headerMatch' => $detect->getMobileHeaders(), // All possible User-Agent headers. 'uaHttpHeaders' => $detect->getUaHttpHeaders(), // All the regexes that trigger 'isMobile' or 'isTablet' // to be true. 'uaMatch' => array( // If match is found, triggers 'isMobile' to be true. 'phones' => $detect->getPhoneDevices(), // Triggers 'isTablet' to be true. 'tablets' => $detect->getTabletDevices(), // If match is found, triggers 'isMobile' to be true. 'browsers' => $detect->getBrowsers(), // If match is found, triggers 'isMobile' to be true. 'os' => $detect->getOperatingSystems() ) ); $jsonString = function_exists('json_format') ? json_format($json) : json_encode($json); // Write the JSON file to disk. // You can import this file in your app. $fileName = dirname(__FILE__).'/../Mobile_Detect.json'; $handle = fopen($fileName, 'w'); $fwrite = fwrite($handle, $jsonString); fclose($handle); if($fwrite){ echo 'Done. Check '.realpath($fileName).' file.'; } else { echo 'Failed to write '.realpath($fileName).' to disk.'; }