bee4/useragent-classify

此包已被废弃,不再维护。作者建议使用bee4/useragent-classifier包代替。

一个用于处理用户代理检测和分类的库

v1.0.1 2015-09-25 11:20 UTC

This package is not auto-updated.

Last update: 2022-02-01 12:43:33 UTC


README

Build Status Scrutinizer Code Quality Code Coverage SensiolabInsight

License

此库允许跟踪和检测谁在使用用户代理:)

安装

Latest Stable Version Total Downloads

可以使用Composer安装此项目。将以下内容添加到您的composer.json文件中

{
    "require": {
        "bee4/useragent-classifier": "~1.0"
    }
}

或者运行以下命令

composer require bee4/useragent-classifier:~1.0

用法

此库由一个Detector对象和不同的Bots实现组成。

use Bee4\UserAgent\Classifier\Detector;

$ua = 'Mozilla/5.0 (compatible; Mail.RU/2.0)';
$bot = Detector::whoIs($ua); //$bot is a Bots\MailRU instance

$bot->getBot(); //Here we get `mailru`
$bot->getName(); //Here we get `mailru-bot`

$ua = 'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)';
$bot = Detector::whoIs($ua); //$bot is a Bots\Google instance

$bot->getBot(); //Here we get `google`
$bot->getName(); //Here we get `google-bot`