sail/useragent
Composer 安装命令:
composer require sail/useragent
包简介
Library to detect the browser and all its info (OS, Platform, ...)
README 文档
README
This Library detect the browser and all its informations, such as the browser name and version, the OS and the platform. It uses Dependency Injection to load a Parser library, so you can choose the level of details you need from the detection.
Parser
- Parser\Simple, it detects the common browsers (Chrome, Safari, Firefox, MSIE), the basic OS (OS X, iOS, Windows, Linux), it detects the device (iPhone,iPad,Android Phone) and the type of useragent (browser, mobile browser, mailer, spider).
- Parser\UAS, it detects all the browser listed in http://user-agent-string.info/list-of-ua using the UAS PHP Api.
- Parser\Quick (in progress), it detect the browser name and the device computer, iphone, ipad, generic mobile.
Quick Start
Install with composer:
{
"require": {
"sail/useragent": "dev-master"
}
}
create an index.php file:
<?php require "vendor/autoload.php"; use Sail\UserAgent; use Sail\Parser\Simple; // test chrome $ua_string = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.56 Safari/537.17"; $ua = new Useragent($ua_string); $ua->pushParser(new Simple()); echo "<pre>"; $info = $ua->getInfo(); print_r($info);
sail/useragent 适用场景与选型建议
sail/useragent 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2.68k 次下载、GitHub Stars 达 28, 最近一次更新时间为 2013 年 04 月 15 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「useragent」 「browser-detection」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 sail/useragent 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 sail/useragent 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 sail/useragent 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Useragent sniffing library for PHP
Useragent sniffing library for PHP
The Universal Device Detection library, that parses User Agents and detects devices (desktop, tablet, mobile, tv, cars, console, etc.), clients (browsers, media players, mobile apps, feed readers, libraries, etc), operating systems, devices, brands and models.
Wrapper for global function in https://github.com/donatj/PhpUserAgent/
A PHP desktop/mobile user agent parser with support for Laravel, based on Mobiledetect
This package is an easy wrapper for the Piwik Device Detector
统计信息
- 总下载量: 2.68k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 28
- 点击次数: 27
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2013-04-15