gbBotDetectPlugin - 0.1.1

Philippe Gamache

You are currently browsing
the website for symfony 1

Visit the Symfony2 website


« Back to the Plugins Home

Signin


Forgot your password?
Create an account

Tools

Stats

advanced search
Information Readme Releases Changelog Contribute
Show source

gbBotDetectPlugin plugin

Overview

The gbBotDetectPlugin is a symfony plugin that provides bots detections.

Installation

1.Download and install the plugin

1.1 Using the Symfony plugin installation task:

./symfony plugin:install gbBotDetectPlugin --stability=beta

1.2 Using the svn version

cd plugins
svn co http://svn.symfony-project.com/plugins/gbBotDetectæPlugin

Configuration

1.Enable the plugin into your ProjectConfiguration

Edit your application config/ProjectConfiguration.class.php to enable the gbBotDetect plugin, and add the line below in the setup function

$this->enablePlugins('gbBotDetectPlugin');

2.Change the parent class in myUser.class.php

If you use the basic sfUser:

class myUser extends sfBotDetectBasicSecurityUser
{
}

OR if you use Guard user:

class myUser extends sfBotDetectGuardSecurityUser
{
}

3.You can edit your application app.yml :

For performance reason, 2 types of bot list exist, the basic (default) and the extended. If you want to chose the extended, edit your app.yml and add :

all:
  gbBotDetect:
    type: extended

Want a customised list? Use one of the basic or extended file as a template (in plugins/gbBotDetectPlugin/data), and copy it in your application config directory and name it gbBotsDetect.yml. And add the following in your app.yml :

all:
  gbBotDetect:
    type: personnal

Want a customised list, a custom filename and custom location for your own bot list? Still possible, add this in your app.yml : Use one of the basic or extended file as a template (in plugins/gbBotDetectPlugin/data), and copy it in your application config directory and name it gbBotsDetect.yml. And add the following in your app.yml :

all:
  gbBotDetect:
    type: personnal
    file: /full/path/to/your/botFileList.yml

Usage

In actions, if you need to know if the user is a bot, simply call :

$this->getUser()->isBot()

In template, if you need to know if the user is a bot, simply call :

$sf_user->isBot()

Will return true if the user is a know bot, and false otherwise.

TODO

  • Finish documentation
  • Add a update bots list task
  • Add Database version with Administration Module