Mobile_Detect is a lightweight PHP class for detecting mobile devices (including tablets). It uses the User-Agent string combined with specific HTTP headers to detect the mobile environment.
I used composer to install the package but I can't load and use the class in my PHP code. I didn't find any example to use it with composer.
Can you give the correct use to use or class name. I tried with this ones:
require 'vendor/autoload.php';
use Detection\MobileDetect;
$mobileDetect = new MobileDetect();
use Detection\MobileDetect;
$mobileDetect = new MobileDetect;
use MobileDetect\MobileDetect;
$mobileDetect = new MobileDetect;
use MobileDetect\MobileDetect;
$mobileDetect = new MobileDetect();
And always get this error: Fatal error: Uncaught Error: Class 'Mobile_Detect' not found in /var/www/html/header.php:17 Stack trace: #0 /var/www/html/index.php(1): require_once() #1 {main} thrown in /var/www/html/header.php on line 17
Hello,
I used
composer
to install the package but I can't load and use the class in my PHP code. I didn't find any example to use it with composer. Can you give the correctuse
to use or class name. I tried with this ones:And always get this error:
Fatal error: Uncaught Error: Class 'Mobile_Detect' not found in /var/www/html/header.php:17 Stack trace: #0 /var/www/html/index.php(1): require_once() #1 {main} thrown in /var/www/html/header.php on line 17
Thanks in advance!