fyre/useragent

A user agent library.

v2.0.6 2024-06-25 04:20 UTC

This package is auto-updated.

Last update: 2024-06-25 04:21:09 UTC


README

FyreUserAgent

FyreUserAgent is a free, open-source user agent library for PHP.

Table Of Contents

Installation

Using Composer

composer require fyre/useragent

In PHP:

use Fyre\Http\UserAgent;

User Agent Creation

  • $agent is a string representing the user agent.
$userAgent = new UserAgent($agent);

Alternatively, you can use the fromString method for easier chaining.

$userAgent = UserAgent::fromString($agent);

Methods

Get Agent String

Get the user agent string.

$agent = $userAgent->getAgentString();

Get Browser

Get the browser.

$browser = $userAgent->getBrowser();

Get Mobile

Get the mobile.

$mobile = $userAgent->getMobile();

Get Platform

Get the platform.

$platform = $userAgent->getPlatform();

Get Robot

Get the robot.

$robot = $userAgent->getRobot();

Get Version

Get the browser version.

$version = $userAgent->getVersion();

Is Browser

Determine if the user agent is a browser.

$isBrowser = $userAgent->isBrowser();

Is Mobile

Determine if the user agent is a mobile.

$isMobile = $userAgent->isMobile();

Is Robot

Determine if the user agent is a robot.

$isRobot = $userAgent->isRobot();