I want to use php device detector that is part of famous Piwik project, but i can't understand how to include and use the code in my php code? i don't want to use composer.
I wrote:
<?php
include 'DeviceDetector.php';
use DeviceDetector\DeviceDetector;
use DeviceDetector\Parser\Device\DeviceParserAbstract;
$dd = new DeviceDetector($_SERVER['HTTP_USER_AGENT']);
$dd->parse();
$clientInfo = $dd->getClient();
var_dump($clientInfo);
But it doesn't work. i get this error:
Fatal error: Uncaught exception 'Exception' with message 'client parser not found' in D:\DeviceDetector.php:214
Stack trace:
#0 D:\DeviceDetector.php(136): DeviceDetector\DeviceDetector->addClientParser('FeedReader')
#1 D:\index.php(67): DeviceDetector\DeviceDetector->__construct('Mozilla/5.0 (Wi...')
#2 {main}
thrown in D:\DeviceDetector.php on line 214
To me I worked well. For DeviceDetector version 3.7.3:
For those not using an autoloader, here is a solution that works with Device Detector version 3.10.1 based on Erick's answer for previous versions: