PHP code example of vuthaihoc / laravel-user-device

1. Go to this page and download the library: Download vuthaihoc/laravel-user-device library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

vuthaihoc / laravel-user-device example snippets


// Basic device detection
$device = \Agent::device(); // Returns device name or false
$robot = \Agent::robot();   // Returns robot name or false

// MobileDetect methods (forwarded dynamically)
\Agent::isMobile();
\Agent::isTablet();
\Agent::is('iPhone');
\Agent::getUserAgent();

// Legacy methods compatibility
\Agent::getBrowsers();
\Agent::getOperatingSystems();
\Agent::getPlatforms();
\Agent::getDesktopDevices();
\Agent::getDetectionRulesExtended();
\Agent::getScriptVersion();