northrook/user-agent

PHP Browser detection using the user agent.

dev-main 2024-08-16 12:24 UTC

This package is auto-updated.

Last update: 2024-11-16 12:55:47 UTC


README

A wrapper for the foroco/php-browser-detection library.

This package offers a simple class parsing the user agent string.

Important

This package is still in development.

While it is considered MVP and stable, it may still undergo breaking changes.

Installation

composer require northrook/user-agent

Usage

The UserAgent class static, and cannot be instantiated.

Access pre-parsed data using these static methods:

use Northrook\UserAgent;

// Retrieve the foroco\BrowserDetection object
$userAgent = UserAgent::detect() : BrowserDetection

// Pass a string to $match the current OS family.
// If no $match is passed, a string with the matched OS family is returned
$os = UserAgent::OS(); 

UserAgent::getAll();
UserAgent::getOS();
UserAgent::getBrowser();

License

MIT