Test Drive¶
Follow these steps to quickly test Lite Firewall locally in a clean environment:
🧪 Quick Test Drive Setup¶
-
Create a temporary folder
-
Install Lite Firewall via Composer
-
Create a basic
firewall.ymlconfiguration
storage:
type: "Kanopi\\Firewall\\Storage\\FileStorage"
config:
storage_file: firewall.data
plugins:
- plugin: "Kanopi\\Firewall\\Plugins\\Url"
response: block
enable: true
config:
- "query.block:1" # Block any request that includes ?block=1
- Create an
index.phpfile
<?php
require __DIR__ . '/vendor/autoload.php';
use Kanopi\Firewall\Firewall;
// Initialize firewall
Firewall::create([__DIR__ . '/firewall.yml'])->evaluate();
echo "Hello, world!";
-
Start a PHP built-in web server
-
Open your browser and test
-
Visit http://localhost:8000 — you should see:
-
Visit http://localhost:8000?block=1 — you should see:
-
Visit http://localhost:8000 — you should see:
This simple example demonstrates how the firewall intercepts requests using YAML configuration and shows how easy it is to add rule-based blocking.
To start over empty the contents of the Storage file