PHP code example of reefki / laravel-device-detector

1. Go to this page and download the library: Download reefki/laravel-device-detector 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/ */

    

reefki / laravel-device-detector example snippets


use Reefki\DeviceDetector\Device;

$device = Device::detect($request->userAgent());

use Reefki\DeviceDetector\Device;

$device = Device::detect($request->userAgent(), $request->server());

use Reefki\DeviceDetector\Device;

$device = Device::detectRequest($request);

$device = $request->device();

if ($device->isBot()) {
    $botInfo = $device->getBot();
} else {
    $clientInfo = $device->getClient();
    $osInfo = $device->getOs();
    $device = $device->getDeviceName();
    $brand = $device->getBrandName();
    $model = $device->getModel();
}
bash
php artisan vendor:publish --provider="Reefki\DeviceDetector\DeviceDetectorServiceProvider" --tag="config"