codeblog/crawlerdetect

A CodeBlog CrawlerDetect class is easy and quick to use. Detecting bots/crawlers/spiders via the user agent!

v1.0.0 2019-03-27 14:56 UTC

This package is auto-updated.

Last update: 2024-12-25 08:22:55 UTC


README

Maintainer Source Code PHP from Packagist Latest Version Software License Build Quality Score Total Downloads

CrawlerDetect is a PHP class for detecting bots / crawlers / spiders through the user agent and http header. Currently capable of detecting thousands of bots.

O CrawlerDetect é uma classe PHP para detectar bots/crawlers/spiders através do agente do usuário e cabeçalho http. Atualmente capaz de detectar milhares de bots.

Highlights

  • Simple installation (Instalação simples)
  • Check the user agent of the current 'visitor' (Verifique o agente do usuário do 'visitante' atual)
  • Pass a user agent as a string (Passar um agente do usuário como uma string)
  • Output the name of the bot that matched if any (Emita o nome do bot que combinou se hover)

Installation

CrawlerDetect is available via Composer:

"codeblog/crawlerdetect": "^1.0"

or run

composer require codeblog/crawlerdetect

Documentation

For details on how to use, see a sample folder in the component directory. In it you will have an example of use for each class. It works like this:

Para mais detalhes sobre como usar, veja uma pasta de exemplo no diretório do componente. Nela terá um exemplo de uso para cada classe. Ele funciona assim:

Usage:

<?php

require __DIR__ . '/../vendor/autoload.php';

use CodeBlog\CrawlerDetect\CrawlerDetect;

$CrawlerDetect = new CrawlerDetect;

// Check the user agent of the current 'visitor'
if($CrawlerDetect->isCrawler()) {
    // true if crawler user agent detected
}

// Pass a user agent as a string
if($CrawlerDetect->isCrawler('Mozilla/5.0 (compatible; Sosospider/2.0; +http://help.soso.com/webspider.htm)')) {
    // true if crawler user agent detected
}

// Output the name of the bot that matched (if any)
echo $CrawlerDetect->getMatches();

Contributing

Please see CONTRIBUTING for details.

Support

Security: If you discover any security related issues, please email whallyssonallain@gmail.com instead of using the issue tracker.

Se você descobrir algum problema relacionado à segurança, envie um e-mail para whallyssonallain@gmail.com em vez de usar o rastreador de problemas.

Thank you

Credits

License

The MIT License (MIT). Please see License File for more information.