sail/useragent 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

sail/useragent

最新稳定版本:1.0.0-alpha2

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);

统计信息

  • 总下载量: 2.68k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 28
  • 点击次数: 5
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 28
  • Watchers: 1
  • Forks: 9
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2013-04-15