OPTIONAL: Set caching method // By default static cache is used, which works best within one php process (memory array caching) // To cache across requests use caching in files or memcache // $dd->setCache(new Doctrine\Common\Cache\PhpFileCache('./tmp/')) // OPTIONAL: Set custom yaml parser // By default Spyc will be used for parsing yaml files. $userAgent = $ _SERVER // change this to the useragent you want to parse $clientHints = ClientHints:: factory( $ _SERVER) // client hints are optional $dd = new DeviceDetector( $userAgent, $clientHints) X.Y) // for other options see VERSION_TRUNCATION_* constants in DeviceParserAbstract class AbstractDeviceParser:: setVersionTruncation( AbstractDeviceParser:: VERSION_TRUNCATION_NONE) OPTIONAL: Set version truncation to none, so full versions will be returned // By default only minor versions will be returned (e.g. Use DeviceDetector\ Parser\ Device\ AbstractDeviceParser composer require matomo/device-detectorĪnd use some code like this one: require_once 'vendor/autoload.php' Just add matomo/device-detector to your projects requirements. Using DeviceDetector with composer is quite easy. The Universal Device Detection library that parses User Agents and Browser Client Hints to detect devices (desktop, tablet, mobile, tv, cars, console, etc.), clients (browsers, feed readers, media players, PIMs.
0 Comments
Leave a Reply. |