PHP code example of apkk / laravel-security-guard

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/ */

    

apkk / laravel-security-guard example snippets


'cache' => [
    'store' => env('SECURITY_GUARD_CACHE_STORE'),
    'prefix' => 'my-application:production',
],

// 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.
})
bash
php artisan vendor:publish --tag=security-guard-migrations --no-interaction
bash
php artisan security-guard:doctor --strict
bash
# Validate configuration for deployment
php artisan security-guard:doctor --strict --json

# Inspect and release a blocked address
php artisan security-guard:blocked:list --active
php artisan security-guard:blocked:release 203.0.113.10 --actor=ops

# Inspect the stored guard state for one address
php artisan security-guard:status 203.0.113.10