northrook / user-agent
PHP Browser detection using the user agent.
dev-main
2024-08-16 12:24 UTC
Requires
- php: >=8.1
- foroco/php-browser-detection: ^2.7
Requires (Dev)
- northrook/core: dev-main
- northrook/dev-env: dev-main
This package is auto-updated.
Last update: 2024-12-16 13:08:20 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();