1. Go to this page and download the library: Download rennf93/symfony-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/ */
rennf93 / symfony-guard example snippets
use RenzoFranceschini\GuardCore\Config\SecurityConfig;
use RenzoFranceschini\GuardCore\Engine\GuardEngine;
use RenzoFranceschini\GuardCoreSymfony\GuardMiddleware;
use Symfony\Component\HttpFoundation\Request;
// Anywhere your App\Kernel is created
$kernel = new GuardMiddleware(
new App\Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']),
new GuardEngine(new SecurityConfig(
enableRedis: false,
blacklist: ['192.0.2.0/24'],
rateLimit: 100,
rateLimitWindow: 60,
enableRateLimiting: true,
))
);