sinergi/browser-detector
最新稳定版本:6.1.4
Composer 安装命令:
composer require sinergi/browser-detector
包简介
Detecting the user's browser, operating system and language.
README 文档
README
Detecting the user's browser, operating system, device and language from PHP. Because browser detection is not always reliable and evolves at all time, use with care and feel free to contribute.
Requirements
This library uses PHP 5.3+.
Install
It is recommended that you install the PHP Browser library through composer. To do so, run the following command:
composer require sinergi/browser-detector
Browser Detection
The Browser class allows you to detect a user's browser and version.
Browsers Detected
- 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
- Samsung Browser
- wkhtmltopdf
Usage
use Sinergi\BrowserDetector\Browser; $browser = new Browser(); if ($browser->getName() === Browser::IE && $browser->getVersion() < 11) { echo 'Please upgrade your browser.'; }
Compatibility Mode
Detect if Internet Explorer is in Compatibility Mode and send the correct header to have the browser render the page in its standard mode. This must be called before any output is sent to the browser.
use Sinergi\BrowserDetector\Browser; $browser = new Browser(); if ($browser->getName() === Browser::IE && $browser->isCompatibilityMode()) { $browser->endCompatibilityMode(); }
OS Detection
The OS class allows you to detect a user's operating system and version.
OS Detected
- Windows
- Windows Phone
- OS X
- iOS
- Android
- Chrome OS
- Linux
- SymbOS
- Nokia
- BlackBerry
- FreeBSD
- OpenBSD
- NetBSD
- OpenSolaris
- SunOS
- OS2
- BeOS
Usage
use Sinergi\BrowserDetector\Os; $os = new Os(); if ($os->getName() === Os::IOS) { echo 'You are using an iOS device.'; }
Device Detection
The Device class allows you to detect a user's device.
Device Detected
- iPad
- iPhone
- Windows Phone
- Lumia
Usage
use Sinergi\BrowserDetector\Device; $device = new Device(); if ($device->getName() === Device::IPAD) { echo 'You are using an iPad.'; }
Language Detection
The Language class allows you to detect a user's language.
Usage
use Sinergi\BrowserDetector\Language; $language = new Language(); if ($language->getLanguage() === 'de') { echo 'Get this website in german.'; }
License
PHP Browser is licensed under The MIT License (MIT).
sinergi/browser-detector 适用场景与选型建议
sinergi/browser-detector 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 8.46M 次下载、GitHub Stars 达 581, 最近一次更新时间为 2026 年 01 月 04 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「browser」 「language」 「detection」 「os」 「operating system」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 sinergi/browser-detector 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 sinergi/browser-detector 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 sinergi/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
统计信息
- 总下载量: 8.46M
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 603
- 点击次数: 34
- 依赖项目数: 41
- 推荐数: 3
其他信息
- 授权协议: MIT
- 更新时间: 2026-01-04