PHPackages                             wolfsoft/botguard-php - 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. [API Development](/categories/api)
4. /
5. wolfsoft/botguard-php

ActiveLibrary[API Development](/categories/api)

wolfsoft/botguard-php
=====================

PHP Integration Library for BotGuard web site protection service.

1.0.2(7y ago)238MITPHPPHP &gt;=5.6.0

Since Aug 22Pushed 5y ago1 watchersCompare

[ Source](https://github.com/wolfsoft/botguard-php)[ Packagist](https://packagist.org/packages/wolfsoft/botguard-php)[ Docs](https://botguard.net/en/documentation/integration)[ RSS](/packages/wolfsoft-botguard-php/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (2)Dependencies (2)Versions (3)Used By (0)

BotGuard PHP API Connector
==========================

[](#botguard-php-api-connector)

[![Latest Stable Version](https://camo.githubusercontent.com/6051e08e29c6f8292762b731dabeb2b45f4c8240f4f2ab358743afdb918a2f57/68747470733a2f2f706f7365722e707567782e6f72672f776f6c66736f66742f626f7467756172642d7068702f762f737461626c65)](https://packagist.org/packages/wolfsoft/botguard-php)[![Build Status](https://camo.githubusercontent.com/5b6a1ec495b272d0c29ba699deadc206720e4befadc49b7f043139418f56415e/68747470733a2f2f7472617669732d63692e6f72672f776f6c66736f66742f626f7467756172642d7068702e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/wolfsoft/botguard-php)[![codecov](https://camo.githubusercontent.com/7c101449d049bae4e87ae2359dac6d2d1012306286813fc4315bf037dfb74f26/68747470733a2f2f636f6465636f762e696f2f67682f776f6c66736f66742f626f7467756172642d7068702f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/wolfsoft/botguard-php)[![License](https://camo.githubusercontent.com/9e78e979126531884231701b171c34c9d3ecb7081bb435389d4354a53b00f03f/68747470733a2f2f706f7365722e707567782e6f72672f776f6c66736f66742f626f7467756172642d7068702f6c6963656e7365)](https://packagist.org/packages/wolfsoft/botguard-php)

An integration library for BotGuard Cloud.

```
use BotGuard\BotGuard;
use BotGuard\Profile;

// Initialize BotGuard Service instance
$botguard = BotGuard::instance([
	'server' => 'xxx.botguard.net',
	'backup' => 'yyy.botguard.net',
]);

// Check incoming request
$profile = $botguard->check();

// Do bot mitigation
if ($profile) {
	switch ($profile->getMitigation()) {
		case Profile::MITIGATION_DENY:
		case Profile::MITIGATION_RETURN_FAKE:
			http_response_code(403);
			exit;
		case Profile::MITIGATION_CHALLENGE:
			http_response_code(403);
			$profile->challenge();
			exit;
		case Profile::MITIGATION_REDIRECT:
		case Profile::MITIGATION_CAPTCHA:
			header('Location: ' . $profile->getMitigationURL(), true, 302);
			exit;
	}
}

echo 'Welcome, human';
```

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

[](#installation)

### With Composer

[](#with-composer)

```
$ composer require wolfsoft/botguard-php

```

```
{
    "require": {
        "wolfsoft/botguard-php": "^1.1"
    }
}
```

```
