User Agent

User agent library parse client browsers all data from request.

Installation

composer require unicframework/user-agent

Example

use UserAgent\UserAgent;

// Parse current request user agent
$user = new UserAgent();

// Parse custom user agent string
$user = new UserAgent($_SERVER['HTTP_USER_AGENT']);

// Get client ip address
echo $user->ip;

// Get client os
echo $user->os;

// Get client os version
echo $user->osVersion;

// Get client browser
echo $user->browser;

// Get client browser version
echo $user->browserVersion;

// Get client device type (Phone, iPhone, Computer, etc.)
echo $user->deviceType;

// Get client device brand name (Apple, Samsung, Lenovo, etc.)
echo $user->deviceBrand;

// Get client referrer
echo $user->referrer;

// Check client is referred or not
if($user->isReferred) {
  //Client is referred
}

// Get client user agent
echo $user->userAgent;

License

MIT License