bee4/useragent-classifier
, (*1)
, (*2)
This library allow to track and detect who is behind useragents :), (*3)
Installing
, (*4)
This project can be installed using Composer. Add the following to your composer.json:, (*5)
{
"require": {
"bee4/useragent-classifier": "~1.0"
}
}
or run this command:, (*6)
composer require bee4/useragent-classifier:~1.0
Usage
This library is composed of a Detector
object and different Bots
implementation., (*7)
```php
use Bee4\UserAgent\Classifier\Detector;, (*8)
$ua = 'Mozilla/5.0 (compatible; Mail.RU/2.0)';
$bot = Detector::whoIs($ua); //$bot is a Bots\MailRU instance, (*9)
$bot->getBot(); //Here we get mailru
$bot->getName(); //Here we get mailru-bot
, (*10)
$ua = 'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)';
$bot = Detector::whoIs($ua); //$bot is a Bots\Google instance, (*11)
$bot->getBot(); //Here we get google
$bot->getName(); //Here we get google-bot
, (*12)