nox-it / yii2-nox-user-agent-parser
此包已被弃用且不再维护。未建议替换包。
Yii2 用户代理解析器
2.0.0
2020-05-03 15:25 UTC
Requires
- php: >=7.4.0
- donatj/phpuseragentparser: ~1.0.0
- nox-it/yii2-nox: ~2.0.0
- nox-it/yii2-nox-mvc: ~2.0.1
README
这是一个为 Yii Framework 2 量身定制的简单精简 PHP 用户代理解析器。
安装
安装此扩展的首选方式是通过 composer。
运行以下命令之一
php composer.phar require --prefer-dist nyx-solutions/yii2-nyx-user-agent-parser "*"
或在您的 composer.json
文件的 require 部分添加以下内容
"nyx-solutions/yii2-nyx-user-agent-parser": "*"
安装
用法
静态使用
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
- Vivaldi
- TizenBrowser
- Lynx
- Wget
- Curl
许可
yii2-nyx-user-agent-parser 在 BSD 3-Clause 许可下发布。有关详情,请参阅随包提供的 LICENSE.md
文件。