Skip to content

A bot detector written in PHP detecting bots visiting your webservice

License

Notifications You must be signed in to change notification settings

BetterCallJohn/vipx-bot-detect

 
 

Repository files navigation

VipxBotDetect

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

Build Status

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['REQUEST_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);

ToDo's

  • Add additional meta data loaders (xml, php)

Credits

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

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

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

About

A bot detector written in PHP detecting bots visiting your webservice

Resources

License

Stars

Watchers

Forks

Packages

No packages published