1. Go to this page and download the library: Download flarex/flareshield 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/ */
use FlareX\FlareShield\Exceptions\ToolPermissionException;
try {
FlareShield::authorizeTool('database.read', ['table' => 'orders']);
$result = $tools->call('database.read', ...);
} catch (ToolPermissionException $e) {
Log::warning('AI tried to call a forbidden tool.', ['ex' => $e->getMessage()]);
}
if (FlareShield::toolRequiresConfirmation('email.send')) {
// present a confirmation step to the user
}
use FlareX\FlareShield\Events\ThreatDetected;
Event::listen(ThreatDetected::class, function (ThreatDetected $e) {
// forward to SIEM, increment Pulse counter, alert on Slack, etc.
});
use FlareX\FlareShield\Contracts\Scanner;
use FlareX\FlareShield\Support\{ScanContext, Severity, Threat};
class CompanySecretScanner implements Scanner
{
public function name(): string { return 'company_secret'; }
public function scan(string $input, ScanContext $ctx): array
{
if (! preg_match('/PROJECT-NEPTUNE/', $input)) return [];
return [new Threat(
'internal_codename',
'Internal codename leaked.',
Severity::Critical,
$this->name(),
)];
}
}