PHPackages                             youds/ban-the-bots - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. youds/ban-the-bots

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

youds/ban-the-bots
==================

Take Control Back On The Web

v0.1.4(5mo ago)16PHPPHP &gt;=5.4

Since Oct 27Pushed 5mo agoCompare

[ Source](https://github.com/youds/ban-the-bots)[ Packagist](https://packagist.org/packages/youds/ban-the-bots)[ RSS](/packages/youds-ban-the-bots/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (4)DependenciesVersions (5)Used By (0)

BanTheBots PHP Kit
==================

[](#banthebots-php-kit)

Take control back on the web by silently trapping non‑compliant crawlers and abusive bots. This PHP package integrates with the BanTheBots cloud API to:

- Drop a hidden "blackhole" link in your pages that only misbehaving bots will follow
- Record the offending IP/user‑agent with the central API
- Deny further access to flagged clients with a 403 and a friendly error page
- Keep good crawlers (that obey `robots.txt`) unaffected

This README explains installation, configuration, and usage.

Requirements
------------

[](#requirements)

- PHP 7.1+ recommended (the library uses class constant visibility available since PHP 7.1)
- cURL extension enabled
- Web server user must have write permission to your public web root (or the directory where `robots.txt` lives)

Note: The `composer.json` currently declares `php ">=5.4"`, but you should run PHP 7.1 or newer for compatibility with this code.

Installation
------------

[](#installation)

### Composer (recommended)

[](#composer-recommended)

```
composer require youds/ban-the-bots
```

Composer will autoload `src/BanTheBots.class.php` for you.

### Manual (no Composer)

[](#manual-no-composer)

- Copy `src/BanTheBots.class.php` into your project
- Require it in your bootstrap:

```
require_once __DIR__ . '/src/BanTheBots.class.php';
```

Quick start
-----------

[](#quick-start)

1. Instantiate the library as early as possible in your request lifecycle (before any output). Optionally pass configuration (see below).
2. Call `apply()` to enforce a decision for the current request.
3. In your layout/footer, call `outputBlackHole()` once to render the hidden link that naughty bots will follow.

Example minimal integration:

```
