Skip to content
Block malicious scripts using protection for your laravel app
Branch: master
Clone or download
Nicolas Beauvais
Nicolas Beauvais Update changelog
Latest commit 47f9858 Jun 7, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
config Apply fixes from StyleCI Feb 13, 2017
src Update filemode Feb 13, 2017
tests Add check method for quicker implementation Feb 13, 2017
.editorconfig Initial commit Feb 13, 2017
.gitattributes Initial commit Feb 13, 2017
.gitignore Update .gitignore Feb 13, 2017
.scrutinizer.yml Initial commit Feb 13, 2017
.styleci.yml Initial commit Feb 13, 2017
.travis.yml Also test against PHP 7.2 (#3) Dec 8, 2017 Update changelog Jun 7, 2019 Initial commit Feb 13, 2017 Initial commit Feb 13, 2017 Update Sep 26, 2017
composer.json Update composer.json (#6) Jun 7, 2019

Laravel BotScout

Latest Version on Packagist Build Status SensioLabsInsight Quality Score Total Downloads


Protect your website against automated scripts using the API.


You can install the package via composer:

composer require nicolasbeauvais/laravel-botscout

Next, you must install the service provider:

// config/app.php
'providers' => [

Add your api key to the .env file:


If needed you can also publish the config file:

php artisan vendor:publish --provider="NicolasBeauvais\LaravelBotScout\BotScoutServiceProvider" --tag="config"

If you want to make use of the facade you must install it as well:

// config/app.php
'aliases' => [
    'BotScout' => NicolasBeauvais\LaravelBotScout\BotScoutFacade::class,


You are highly advised to read the API guide to understand the meaning of each method.


You can easily use botscout in your existing validators:

// Validate name
$validator = Validator::make(['name' => 'John Doe'], [
  'name' => 'required|botscout_name'

// Validate email
$validator = Validator::make(['email' => ''], [
  'email' => 'required|botscout_mail'

// Validate ip
$validator = Validator::make(['ip' => ''], [
  'ip' => 'required|botscout_ip'

Note that you will need to create the validation message by yourself, as described in the Laravel documentation.


You can use the BotScout facade anywhere in your app:

BotScout::multi('John Doe', '', '')->isValid();

BotScout::all('John Doe')->isValid();

BotScout::name('John Doe')->isValid();



// We also include a quick way of testing a user with integrated exception catch
BotScout::check('John Doe', '', ''); // true or false

Real life example using the check method

The check method is the recommended way to validate a register form:

The check method is a wrapper to the multimethod that catch any http error / timeout. If the botscout api is not responding, the method will return false.

// Create a classic validation 
$validator = Validator::make($request->all(), [
    'email' => 'required|email|unique:users',
    'name' => 'required|max:20',

$validator->after(function ($validator) {
    if (!BotScout::check($request->get('name'), $request->get('email'), $request->ip())) {
        $validator->errors()->add('email', 'Sorry, it looks like your a bot!');


Please see CHANGELOG for more information what has changed recently.


$ composer test


Please see CONTRIBUTING for details.


If you discover any security related issues, please email instead of using the issue tracker.



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

You can’t perform that action at this time.