PHP code example of saarors / firewtwall-php

1. Go to this page and download the library: Download saarors/firewtwall-php 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/ */

    

saarors / firewtwall-php example snippets



re_once __DIR__ . '/vendor/saarors/firewtwall-php/php/waf.php';


ur application starts here


return [
    'allowed_methods'   => ['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'OPTIONS', 'HEAD'],
    'max_body_size'     => 10 * 1024 * 1024,   // 10 MB
    'rate_limit'        => [
        'window_sec'         => 60,
        'max_requests'       => 100,
        'block_duration_sec' => 600,
    ],
    'whitelist'         => [],                  // IPs / CIDRs that bypass all checks
    'blacklist'         => [],                  // IPs / CIDRs always blocked
    'bypass_paths'      => ['/health', '/ping'],
    'trusted_proxies'   => [],
    'mode'              => 'reject',            // 'reject' | 'log-only'
    'log_path'          => __DIR__ . '/../logs/waf.log',
    'response_type'     => 'json',              // 'json' | 'html'
    'debug'             => false,
];
bash
composer 
ini
auto_prepend_file = /path/to/vendor/saarors/firewtwall-php/php/waf.php
ini
auto_prepend_file = /absolute/path/to/fireWTwall/php/waf.php
apache
php_value auto_prepend_file "/absolute/path/to/fireWTwall/php/waf.php"
ini
extension=apcu
apc.enabled=1
xml
<configuration>
  <system.webServer>
    <!-- IIS Integrated pipeline (recommended) -->
    <modules>
      <add name="FireWTWallModule" type="FireWTWall.WafHttpModule" />
    </modules>
  </system.webServer>

  <!-- IIS Classic pipeline (legacy) -->
  <system.web>
    <httpModules>
      <add name="FireWTWallModule" type="FireWTWall.WafHttpModule" />
    </httpModules>
  </system.web>
</configuration>