1. Go to this page and download the library: Download middlewares/firewall 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/ */
middlewares / firewall example snippets
Dispatcher::run([
(new Middlewares\Firewall(['123.0.0.*']))
->blacklist([
'123.0.0.1',
'123.0.0.2',
])
]);
$firewall = new Middlewares\Firewall([
'127.0.0.1',
'198.168.0.*',
]);
$responseFactory = new MyOwnResponseFactory();
$firewall = new Middlewares\Firewall($whitelist, $responseFactory);
Dispatcher::run([
//detect the client ip and save it in client-ip attribute
new Middlewares\ClientIP(),
//use that attribute
(new Middlewares\Firewall(['123.0.0.*']))
->ipAttribute('client-ip')
]);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.