vipx/bot-detect 问题修复 & 功能扩展

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

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

vipx/bot-detect

最新稳定版本:v2.1.0

Composer 安装命令:

composer require vipx/bot-detect

包简介

Bot detector library

关键字:

README 文档

README

This library helps you detecting bots like Google, Yahoo or Bing.

Tests Coverage Status

Installation using composer

$ php composer.phar require vipx/bot-detect

Usage

use Vipx\BotDetect\BotDetector;
use Symfony\Component\Config\FileLocator;
use Vipx\BotDetect\Metadata\Loader\YamlFileLoader;

# Instantiate Symfony components required to load and parse YAML files.
$locator = new FileLocator();
$loader = new YamlFileLoader($locator);

# Use extended bot list prodivded in Resources directory.
$metadataFile = './Resources/metadata/extended.yml';

# Instantiate a BotDetector with the YamlFileLoader instance and path to YAML.
$detector = new BotDetector($loader, $metadataFile);

# Call detect() on BotDetector, passing in a user agent string and IP address,
# most commonly found in $_SERVER['HTTP_USER_AGENT'] and $_SERVER['REMOTE_ADDR']
# respectively.
# detect() will return a Vipx\BotDetect\Metadata\Metadata object containing the
# details of a matched bot and null on no match.
$bot = $detector->detect($agent, $ip);

Note: To greatly improve performance, BotDetector has a built in cache, which can be used to speed up parsing and loading of metadata.

# Instantiate a BotDetector with additional options.
$detector = new BotDetector($loader, $metadataFile, [
  'debug' => $debug,
  'cache_dir' => '/acme/cache',
]);

Via additional options metadata_cache_file and metadata_dumper_class you can further control how cache files are named or generated.

ToDo's

  • Add additional meta data loaders (xml, php)
  • Replace static fixtures with dynamically added data for example from an external archive with some kind of public API or other repository e.g. on Github or Bitbucket

Credits

The first version of list of bots is coming from Manage_Bots script created by the phpBB community. The following community members and contributors worked on the script and its list of bots:

phpBB Community

Marcus Wendel, ReptileGuy, Young Jedi Knight, Pony99CA, Clava, ricjonhay, roBBx, Sr X, HGN, AmigoJack, millipede, maxwell2, StandBy, ade74, heredia21, TheSnake, natalia26, Puchahawa, T50, Peter77sx, Schwpz, Vinny, lanesharon, leschek, fac7orx, Joshua203, Paul, doktornotor, stokerpiller and raimon

Contributors

COil, jdeniau, rubenrua, smilesrg, jbboehr

If you find one or more missing bots, simple fork this repository and add them to the fitting metadata files.

统计信息

  • 总下载量: 330.48k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 48
  • 点击次数: 2
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 44
  • Watchers: 4
  • Forks: 16
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2012-09-15