VadiGuard shield logoVadiGuard
Home / Integrations

Integrations for your stack

Every integration has two parts: the SDK script on the page, and a server-side check before you save data. The dashboard fills in your site keys for each snippet.

Step 1: add the SDK

Place this before </body> on every page with a form. Replace the key with the public key from your Websites page.

<script>
  window.VeguardConfig = {
    siteKey: "YOUR_PUBLIC_KEY",
    apiBase: "https://veguard.pro",
    formProtection: true,
    botDetection: true,
    spamCheck: true,
    autoBlock: true
  };
</script>
<script src="https://veguard.pro/sdk/vadiguard.js"></script>

Step 2: verify on your server

Post the token and request details to /api/v1/verify with your secret key, and only continue when allowed is true. Keep the secret key on the server; it never goes in page code.

Plain PHP

$result = vadiguard_verify($_POST);   // helper posts site_key, secret_key, token, ip, user agent, domain, payload
if (!$result || $result['allowed'] !== true) {
    http_response_code(403);
    exit('Request blocked by security system.');
}

Laravel

A middleware class (VeguardMiddleware) calls the verify endpoint with Laravel's HTTP client and aborts with a 403 when the request is not allowed. Register it in the Kernel and attach it to routes such as Route::post('/contact', ...).

CodeIgniter 3

A helper, application/helpers/vadiguard_helper.php, reads the token, IP and user agent through CodeIgniter's input class. Call it in your controller and use show_error(..., 403) on a block.

Node.js / Express

Middleware (vadiguard-middleware.js) verifies the request before your route handler runs.

WordPress

A VadiGuard plugin for WordPress sites, including multisite. For a WordPress-specific overview see the WordPress security plugin page.

HTML, JavaScript and React

Static and front-end sites use the SDK, with the verify call made from whatever backend receives the form.

What the verify response looks like

{
  "allowed": true,
  "risk_score": 23,
  "action": "allow"
}

Possible actions are allow, log only, challenge, block, temporary block and permanent block. The reason is logged in your dashboard. See how scoring works.

Setup time

Adding the script tag takes a few minutes; the server-side check is a few lines in the framework you already use. If you would like help, book a walkthrough.