1. Go to this page and download the library: Download ruvelo/laravel-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/ */
$device->isBot; // true
$device->botName; // "ClaudeBot"
$device->botCategory; // BotCategory::AiCrawler
$device->isAiBot(); // true for AiCrawler, AiSearch and AiAssistant
use Ruvelo\Device\Device;
use Ruvelo\Device\DeviceType;
$device = $request->device(); // the request macro
$device = Device::fromRequest(); // the current request
$device = Device::fromUserAgent($ua); // any string, e.g. from your logs
$device = Device::fromUserAgent($ua, $headers); // with Sec-CH-UA-*, Accept-Language... in any common shape
$device->is('mobile'); // phones and tablets
$device->is(DeviceType::Tv, 'console'); // any of these
$device->browser->is('firefox'); // case-insensitive name check
$device->browser->major(); // 143
(string) $device->os; // "Windows 11"
$device->language(); // "fr-be"
$device->toArray(); // see below
use Ruvelo\Device\Testing\UserAgents;
$this->withHeader('User-Agent', UserAgents::IPHONE)->get('/')->assertSee('Get the app');
$this->withHeader('User-Agent', UserAgents::GPTBOT)->get('/articles/1')->assertForbidden();
php artisan vendor:publish --tag=device-config
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.