Download the PHP package benclerc/sophos-xgapi without Composer
On this page you can find all versions of the php package benclerc/sophos-xgapi. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download benclerc/sophos-xgapi
More information about benclerc/sophos-xgapi
Files in benclerc/sophos-xgapi
Package sophos-xgapi
Short Description Library used for interacting with Sophos XG firewall API.
License MIT
Homepage https://github.com/benclerc/SophosXGAPI
Informations about the package sophos-xgapi
Sophos XGAPI
Sophos XGAPI is a PHP library for requesting Sophos XG firewalls. This library can :
- Retrieve data from the firewall
- Set data on the firewall
- Remove data from the firewall
You can find all supported entities' names on Sophos website.
Table of contents
- Getting started
- Documentation
- Config class
- XGAPI class
- get()
- set()
- remove()
Getting started
- Get Composer.
- Install the library using composer
composer require benclerc/sophos-xgapi
. - Add the following to your application's main PHP file
require 'vendor/autoload.php';
. - Instanciate the Config class with the firewall's hostname, username and password
$configFirewall = new \Sophos\Config('123.123.123.123', 'admin', 'password');
. - Use the Config object previously created to instanciate the XGAPI object
$firewall = new \Sophos\XGAPI($configFirewall);
. - Start using the library
$hosts = $firewall->get(['IPHost']);
.
Documentation
You can find a full documentation here.
Config class
This Config class is used to prepare the mandatory configuration information to instanciate and use the XGAPI class. In the constructor you must pass :
- The firewall's hostname (FQDN)
- A valid user's username
- The valid user's password
Optional parameters :
- CURL timeout : 10000ms. Use
setTimeout()
to change. - CURL SSL verify peer option : TRUE. Use
setSSLVerifyPeer()
to change. - CURL SSL verify host option : 2. Use
setSSLVerifyHost()
to change.
Example :
XGAPI class
get()
This method is used to retrieve data from the firewall. You must set which entity/entities you want to retrieve and you can set a filter for each one. Be careful, if you set several filters for the same entity they add up like a 'OR' not an 'AND'. Be careful not all attributes are filterable, see Sophos documentation. Available criterias for filtering :
- =
- like
- !=
Examples :
set()
This method is used to set data on the firewall. You must set all mandatory attributes for each entities you want to add.
Examples :
remove()
This method is used to remove data from the firewall. You must set the entities you want to delete as well as the name of the objects you want to delete, you cannot delete on anything else than the object's name.
Examples :