1. Go to this page and download the library: Download apkk/laravel-security-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/ */
// bootstrap/app.php, inside withMiddleware(...)
$middleware->trustProxies(at: [
'192.0.2.0/24', // Replace with the address range of your actual proxy.
]);
'ip_resolver' => [
'driver' => 'remote_addr',
],
use Apkk\LaravelSecurityGuard\Http\Middleware\GuardPublicRequests;
use Illuminate\Foundation\Configuration\Middleware;
->withMiddleware(function (Middleware $middleware): void {
$middleware->prepend(GuardPublicRequests::class);
// Keep your application's existing middleware configuration here.
})