Skip to content

3. Instantiation

Gurdeep Singh (Guru) edited this page Aug 12, 2024 · 1 revision

via CLI Management Tool

PHPFirewall CLI management tool module is available for PHPTerminal.

Please see documentation for PHPTerminal here: PHPTerminal Wiki

In this PHPFirewall documentation, I will show and explain the commands you can use to manage the firewall filters. There is no web tool currently available for firewall management. You can develop your own tool or integrate it into your system as you like.

To instantiate PHPTerminal from your root directory where composer packages are installed:

vendor/bin/phpterminal

Once you are logged into the PHPTerminal, from the configuration terminal mode, change the module to firewall

guru@guru-lappy:/var/www/html/projects/phpfw$ vendor/bin/phpterminal 

Welcome to PHP Terminal!
Type help or ? (question mark) for help.


phpterminal:base> enable 

USERNAME : admin
PASSWORD : ***

Authenticated! Welcome Administrator...

admin@phpterminal:base# config terminal 
admin@phpterminal:base(config)# switch module firewall

PHPTerminal-modules-firewall is an firewall module for PHPTerminal to manage PHPFirewall library.

admin@phpterminal:firewall(config)# 

Now, you can run firewall related commands via the PHPTerminal and manage the firewall.

via PHP Firewall Class

<?php

include 'vendor/autoload.php';

// Instantiate firewall class
$firewall = new \PHPFirewall\Firewall;