bleuren/agent is a Laravel package for enhanced user agent parser for laravel.
It currently has 0 GitHub stars and 78 downloads on Packagist (latest version v1.0.1).
Install it with composer require bleuren/agent.
Discover more Laravel packages by bleuren
or browse all Laravel packages to compare alternatives.
Last updated
The bleuren/agent package is an enhanced user agent parser for Laravel applications. It provides functionality to detect various types of devices, browsers, operating systems, and crawlers, which enables developers to tailor user experiences based on the detected environment.
To install the package, run the following command in your Laravel project:
composer require bleuren/agent
$isDesktop = Agent::isDesktop();
$isMobile = Agent::isMobile();
$isTablet = Agent::isTablet();
$browser = Agent::browser();
$platform = Agent::platform();
// Check if the current user agent is a robot.
$isRobot = Agent::isRobot();
// Alternatively, the same result can be achieved with isCrawler()
$isCrawler = Agent::isCrawler();
// You can also check for a specific crawler by passing a user agent string.
$isSpecificCrawler = Agent::isCrawler('specific-user-agent-string');
// Retrieve the name of the detected robot/crawler, if any.
$robot = Agent::robot();
Agent::setHttpHeaders(['User-Agent' => $_SERVER['HTTP_USER_AGENT']]);
$httpHeaders = Agent::getHttpHeaders();
$mobileHeaders = Agent::getMobileHeaders();
$cloudFrontHeaders = Agent::getCloudFrontHttpHeaders();
Agent::setUserAgent('specific-user-agent-string');
$userAgent = Agent::getUserAgent();
// Determine the device type: 'desktop', 'mobile', 'tablet', or 'robot'.
$deviceType = Agent::deviceType();
// Browser and platform detection
$browser = Agent::browser();
$platform = Agent::platform();
// Detailed robot detection
if (Agent::isRobot()) {
$robot = Agent::robot();
}