nyx-solutions / yii2-nyx-user-agent-parser
Yii2 用户代理解析器
5.0.0
2022-06-02 14:43 UTC
Requires
- php: >=8.1.0 <8.2
- donatj/phpuseragentparser: ~1.0.0
- nyx-solutions/yii2-nyx: ~5.0.0
- nyx-solutions/yii2-nyx-mvc: ~5.0.0
README
一个为 Yii Framework 2 简化和优化的 PHP 用户代理解析器。
安装
安装此扩展的首选方式是通过 composer。
运行以下命令之一
php composer.phar require --prefer-dist nyx-solutions/yii2-nyx-user-agent-parser "*"
或
"nyx-solutions/yii2-nyx-user-agent-parser": "*"
将以下内容添加到您的 composer.json
文件中的 require 部分。
使用方法
静态地
use nyx\components\http\userAgent\Parser; $userAgent = UserAgentParser::parse(); // or UserAgentParser::parse($ua); $userAgent->ua; // [Searched UserAgent] $userAgent->successfullyParsed; // [Has UserAgent Results] $userAgent->platform; // [Detected Platform] $userAgent->browser; // [Detected Browser] $userAgent->version; // [Detected Browser Version]
作为对象
use nyx\components\http\userAgent\Parser; $userAgent = new UserAgentParser(); $userAgent->ua; // [Searched UserAgent] $userAgent->successfullyParsed; // [Has UserAgent Results] $userAgent->platform; // [Detected Platform] $userAgent->browser; // [Detected Browser] $userAgent->version; // [Detected Browser Version]
当前检测到的平台
- 桌面
- Windows
- Linux
- Macintosh
- Chrome OS
- 移动
- Android
- iPhone
- iPad / iPod Touch
- Windows Phone OS
- Kindle
- Kindle Fire
- BlackBerry
- Playbook
- Tizen
- 控制台
- Nintendo 3DS
- New Nintendo 3DS
- Nintendo Wii
- Nintendo WiiU
- PlayStation 3
- PlayStation 4
- PlayStation Vita
- Xbox 360
- Xbox One
当前检测到的浏览器
- Android 浏览器
- BlackBerry 浏览器
- Camino
- Kindle / Silk
- Firefox / Iceweasel
- Safari
- Internet Explorer
- IEMobile
- Chrome
- Opera
- Midori
- Vivaldi
- TizenBrowser
- Lynx
- Wget
- Curl
许可证
yii2-nyx-user-agent-parser 在 BSD 3-Clause 许可证下发布。有关详细信息,请参阅附带的 LICENSE.md
。