1. Go to this page and download the library: Download arkitecht/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/ */
arkitecht / firewall example snippets
Route::group(['middleware' => 'fw-block-bl'], function ()
{
Route::get('/', 'HomeController@index');
});
Route::group(['middleware' => 'fw-block-bl'], function ()
{
Route::get('coming/soon', function()
{
return "We are about to launch, please come back in a few days.";
});
Route::group(['middleware' => 'fw-allow-wl'], function ()
{
Route::get('/', 'HomeController@index');
});
});
$ip = '10.17.12.1';
$whitelisted = Firewall::isWhitelisted($ip);
$blacklisted = Firewall::isBlacklisted($ip);
Firewall::whitelist($ip);
Firewall::blacklist($ip, true); /// true = force in case IP is whitelisted
if (Firewall::whichList($ip)) // returns false, 'whitelist' or 'blacklist'
{
Firewall::remove($ip);
}