northrook/user-agent

使用用户代理进行 PHP 浏览器检测。

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

This package is auto-updated.

Last update: 2024-09-16 12:34:07 UTC


README

用于封装 foroco/php-browser-detection 库的包装器。

此包提供了一个简单的类,用于解析用户代理字符串。

重要

此包仍在开发中。

尽管它被认为是 MVP 且稳定,但它可能仍然会进行破坏性更改。

安装

composer require northrook/user-agent

使用方法

UserAgent 类为静态类,不能实例化。

使用以下静态方法访问预解析的数据

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();

许可

MIT