Skip to content
PHP Web Application Firewall
PHP
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github
examples
src
tests
.gitattributes
.gitignore
.travis.yml
LICENSE
README.md
composer.json
phpunit.xml

README.md

php-waf

Build Status License

PHP Web Application Firewall

Requirements

  • PHP >= 7.0

Installation

If Composer is not installed on your system yet, you may go ahead and install it using this command line:

$ curl -sS https://getcomposer.org/installer | php

Next, add the following require entry to the composer.json file in the root of your project.

{
    "require" : {
        "riverside/php-waf" : "*"
    }
}

Finally, use Composer to install php-waf and its dependencies:

$ php composer.phar install 

How to use

  1. Configure your web server
    • Apache
    php_value auto_prepend_file "/path/to/waf.php"
    
    • Nginx
    fastcgi_param PHP_VALUE "auto_prepend_file=/path/to/waf.php";
    
  2. Create an Firewall instance
    • waf.php
    <?php
    $waf = new \PhpWaf\Firewall();
    $waf->run();

Available filters

Filter Description
SQL Prevent SQL Injections
XSS XSS Attacks
XML Stops XML Attacks
You can’t perform that action at this time.