PHP code example of botect / botect-php

1. Go to this page and download the library: Download botect/botect-php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

botect / botect-php example snippets




declare(strict_types=1);

onfiguration;

return Botect::create(
    new Configuration(
        siteKey: (string) getenv('BOTECT_SITE_KEY'),
        privateKey: getenv('BOTECT_PRIVATE_KEY') ?: null,
    ),
);

 $botect = 

$botect = Botect::create(
    new Configuration(
        siteKey: (string) getenv('BOTECT_SITE_KEY'),
        privateKey: getenv('BOTECT_PRIVATE_KEY') ?: null,
    ),
    storageDirectory: __DIR__.'/var/botect',
    delivery: 'spool',
);

use Illuminate\Support\Facades\Schedule;

Schedule::command('botect:flush --limit=100')
    ->everyMinute()
    ->withoutOverlapping()
    ->runInBackground();

$verdict = $botect->lookupVerdict($sessionToken, ['path' => '/checkout']);

if ($verdict->available()) {
    $score = $verdict->score;
    $action = $verdict->action;
    $reason = $verdict->reason;
}

use Botect\Laravel\Facades\Botect;

$verdict = Botect::lookupVerdict($sessionToken);

$queued = $botect->loggedIn($sessionToken);

use Botect\Laravel\Facades\Botect;

$queued = Botect::loggedIn($sessionToken);

'tracking' => [
    'enabled' => true,
    'scope' => 'web',
    'inject_collector' => true,
    'except' => ['admin/*'],
],

'tracking' => [
    'enabled' => true,
    'scope' => 'manual',
],

Route::get('/search', SearchController::class)->middleware('botect.track');

use Botect\Laravel\Facades\Botect;

$sessionToken = Botect::sessionToken(
    (string) request()->cookie(config('botect.cookie_name'), ''),
);

use Illuminate\Support\Facades\Route;

Route::get('/checkout', CheckoutController::class)
    ->middleware('botect.enforce');
bash
composer config repositories.botect vcs https://github.com/botect/botect-php.git
composer 
bash
php artisan vendor:publish --tag=botect-config
dotenv
BOTECT_SERVER_INGEST_ENABLED=true