1. Go to this page and download the library: Download loguard/loguard-sdk 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/ */
loguard / loguard-sdk example snippets
use LoGuard\Sdk\Client;
use LoGuard\Sdk\Config;
$client = new Client(new Config(
apiKey: getenv('LOGUARD_API_KEY'),
service: 'checkout-api'
));
$client->event(
type: 'login_failed',
ip: $_SERVER['REMOTE_ADDR'] ?? '127.0.0.1',
path: '/login',
statusCode: 401
);
use LoGuard\Sdk\Dispatch\FileSpool;
$spool = new FileSpool('/var/spool/loguard');
$client = new Client($config, eventSink: $spool);
$client->eventAsync('http_error', $ip, $path, 403);
use LoGuard\Sdk\Dispatch\SpoolWorker;
$worker = new SpoolWorker($client, $spool);
$sent = $worker->runOnce(50);