apanly/browser-detector
Composer 安装命令:
composer require apanly/browser-detector
包简介
根据UA判断浏览器类型和版本,操作系统,设备型号
README 文档
README
主要作用
- 根据UA判断浏览器类型和版本,
- 根据UA判断操作系统和版本号
- 根据UA判断设备
检测支持
可检测浏览器
- QQ浏览器
- UC浏览器
- 百度浏览器
- 360浏览器
- 猎豹浏览器
- Vivaldi
- Opera
- Opera Mini
- WebTV
- Internet Explorer
- Pocket Internet Explorer
- Microsoft Edge
- Konqueror
- iCab
- OmniWeb
- Firebird
- Firefox
- Iceweasel
- Shiretoko
- Mozilla
- Amaya
- Lynx
- Safari
- Chrome
- Navigator
- GoogleBot
- Yahoo! Slurp
- W3C Validator
- BlackBerry
- IceCat
- Nokia S60 OSS Browser
- Nokia Browser
- MSN Browser
- MSN Bot
- Netscape Navigator
- Galeon
- NetPositive
- Phoenix
- SeaMonkey
- Yandex Browser
- Comodo Dragon
可检测操作系统
- Windows
- Windows Phone
- OS X
- iOS
- Android
- Chrome OS
- Linux
- SymbOS
- Nokia
- BlackBerry
- FreeBSD
- OpenBSD
- NetBSD
- OpenSolaris
- SunOS
- OS2
- BeOS
可检测设备
- iPad
- iPhone
- Windows Phone
- OPPO手机(OPPO)
- 红米手机(Redmi)
- 小米手机(XiaoMi)
- 乐视手机(Letv)
- Vivo手机(Vivo)
- 三星手机(Samsung)
- 华为手机(HuaWei)
- 联想手机(Lenovo)
- HTC
- 魅族手机(Meizu)
- 中兴手机(ZTE)
- 一加手机(ONEPLUS)
安装
composer require apanly/browser-detector
使用
use apanly\BrowserDetector\Browser;
use apanly\BrowserDetector\Os;
use apanly\BrowserDetector\Device;
$browser = new Browser();
if ($browser->getName() === Browser::IE && $browser->getVersion() < 11) {
echo 'Please upgrade your browser.';
}
$os = new Os();
if ($os->getName() === Os::IOS) {
echo 'You are using an iOS device.';
}
$device = new Device();
if ($device->getName() === Device::IPAD) {
echo 'You are using an iPad.';
}
说明
本项目大部分源码clone 参考资料的sinergi/php-browser-detector,主要是原项目无法适应中国国情,需要修改,故此另开一个项目
Lecense
PHP Browser is licensed under The MIT License (MIT).
参考资料
apanly/browser-detector 适用场景与选型建议
apanly/browser-detector 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2.67k 次下载、GitHub Stars 达 30, 最近一次更新时间为 2016 年 10 月 26 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「browser」 「language」 「detection」 「os」 「operating system」 「浏览器」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 apanly/browser-detector 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 apanly/browser-detector 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 apanly/browser-detector 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Give your JS App some Backbone with Models, Views, Collections, and Events.
Texy converts plain text in easy to read Texy syntax into structurally valid (X)HTML. It supports adding of images, links, nested lists, tables and has full support for CSS. Texy supports hyphenation of long words (which reflects language rules), clickable emails and URL (emails are obfuscated again
Easy to use i18n translation PHP class for multi-language websites
Package for convenient work with Laravel's localization features
Shim repository for phpmd/phpmd
统计信息
- 总下载量: 2.67k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 31
- 点击次数: 17
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-10-26