yooer/useragent-parser
最新稳定版本:1.0.5
Composer 安装命令:
composer require yooer/useragent-parser
包简介
A PHP library for detecting browser, operating system and device from user agent strings
README 文档
README
A PHP library for parsing and detecting user agent strings to identify browsers, operating systems, and devices.
Features
- Detects browser type and version
- Identifies device type and brand
- Detects operating system and version
- Supports mobile device detection
- Compatible with most mainstream browsers and operating systems
Installation
Using Composer:
composer require yooer/useragent-parser
Usage
Basic usage:
<?php require 'vendor/autoload.php'; use UserAgent\Parser; // Get current user agent string $userAgentString = $_SERVER['HTTP_USER_AGENT']; // Parse the user agent $ua = Parser::analyze($userAgentString); // Get browser information echo "Browser: " . $ua->browser['name'] . " " . $ua->browser['version'] . "\n"; // Get OS information echo "OS: " . $ua->os['name'] . " " . $ua->os['version'] . "\n"; // Get device information echo "Device: " . $ua->device['title'] . "\n";
For more advanced usage, see the example files in the examples directory.
License
This project is licensed under the GNU GPL v3 License - see the LICENSE file for details.
统计信息
- 总下载量: 24
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0
- 更新时间: 2025-03-17