1. Go to this page and download the library: Download mmeyer2k/laravel-sqli-guard 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/ */
mmeyer2k / laravel-sqli-guard example snippets
DB::select("select * from users where id = '$unsafe'");
DB::select("select * from users where id = ?", [$unsafe]);
use Mmeyer2k\LaravelSqliGuard\SqliGuard;
SqliGuard::allowUnsafe();
// Execute queries that would normally be blocked
SqliGuard::blockUnsafe();
use Mmeyer2k\LaravelSqliGuard\Events\QueryBlocked;
Event::listen(QueryBlocked::class, function (QueryBlocked $event) {
// $event->needle — the pattern that matched
// $event->query — the full query string
// Send to Slack, PagerDuty, etc.
});