PHPackages                             benclerc/fortinet-fortimanagerapi - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. benclerc/fortinet-fortimanagerapi

ActiveLibrary[API Development](/categories/api)

benclerc/fortinet-fortimanagerapi
=================================

PHP library used for interacting with Fortinet firewall manager (FortiManager) API.

6.4.5(5y ago)2232MITPHPPHP &gt;=7.4.0

Since Apr 14Pushed 5y ago2 watchersCompare

[ Source](https://github.com/benclerc/Fortinet-FortiManagerAPI)[ Packagist](https://packagist.org/packages/benclerc/fortinet-fortimanagerapi)[ Docs](https://github.com/benclerc/Fortinet-FortiManagerAPI)[ RSS](/packages/benclerc-fortinet-fortimanagerapi/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (2)Used By (0)

Fortinet FortiManager API
=========================

[](#fortinet-fortimanager-api)

*This library is automatically generated, if you want support for a newer version, please open an issue.*

PHP library used for interacting with Fortinet firewall manager (FortiManager) APIs (CLI, DeviceManager, PolicyManager, SecurityConsole, System and Task). This library can retrieve, create, update and delete configuration on the FortiManager.

You can find all supported methods on [Fortinet's developer website](https://fndn.fortinet.net/index.php?/fortiapi/5-fortimanager/), you will need an account to browse information.

Table of contents
-----------------

[](#table-of-contents)

- [Getting started](#getting-started)
- [Documentation](#documentation)
    - [Config class](#config-class)
        - [Usage](#usage)
        - [Examples](#examples)
    - [CLI, DeviceManager, PolicyManager, SecurityConsole, System and Task classes](#cli-devicemanager-policymanager-securityconsole-system-and-task-classes)
        - [Usage](#usage)
        - [Examples](#examples-1)
        - [Workspace](#workspace)

Getting started
---------------

[](#getting-started)

1. Get [Composer](http://getcomposer.org/).
2. Install the library using composer `composer require benclerc/fortinet-fortimanagerapi`.
3. Add the following to your application's main PHP file `require 'vendor/autoload.php';`.
4. Instanciate the Config class with the fortimanager's hostname, username and password `$configConnection = new \Fortinet\FortiManagerAPI\Config('123.123.123.123', 'admin', 'password');`.
5. Use the Config object previously created to instanciate the wanted class `$policyManager = new \Fortinet\FortiManagerAPI\PolicyManager($configConnection);`.
6. Start using the library `$globalAddrObj = $policyManager->getGlobalObjectFirewallAddress();`.

Documentation
-------------

[](#documentation)

You can find a full documentation [here](https://benclerc.github.io/Fortinet-FortiManagerAPI/).

### Config class

[](#config-class)

#### Usage

[](#usage)

This Config class is used to prepare the mandatory configuration information to instanciate and use the different classes. In the constructor you must pass :

1. The fortimanager's hostname (FQDN) or IP address
2. A valid user's username
3. The valid user's password

Optional parameters :

- Timeout : 5000ms. Use `setTimeout()` to change.
- SSL verify peer option : TRUE. Use `setSSLVerifyPeer()` to change.
- SSL verify host option : 2. Use `setSSLVerifyHost()` to change.

#### Examples

[](#examples)

```
// Basic configuration
$configConnection = new \Fortinet\FortiManagerAPI\Config('123.123.123.123', 'admin', 'password');

// Configuration for very slow firewalls/long requests
$configConnection = new \Fortinet\FortiManagerAPI\Config('123.123.123.123', 'admin', 'password');
$configConnection->setTimeout(20000);

// Unsecure configuration
$configConnection = new \Fortinet\FortiManagerAPI\Config('123.123.123.123', 'admin', 'password');
$configConnection->setSSLVerifyPeer(FALSE)->setSSLVerifyHost(FALSE);

// The class logins to the FortiManager when being instanciated hence the try/catch statement.
// Here I use the class PolicyManager for the example but it the same for the other classes.
try {
	$policyManager = new \Fortinet\FortiManagerAPI\PolicyManager($configConnection);
} catch (Exception $e) {
	echo('Handle error : '.$e->getMessage());
}
```

### CLI, DeviceManager, PolicyManager, SecurityConsole, System and Task classes

[](#cli-devicemanager-policymanager-securityconsole-system-and-task-classes)

#### Usage

[](#usage-1)

These classes uses Exception to handle errors, for nominal execution you should instanciate and request methods inside try/catch statements.

#### Examples

[](#examples-1)

```
// Get an address object named OBJ_IP in global database
try {
	$res = $policyManager->getOneGlobalObjectFirewallAddress('OBJ_IP');
	echo('Subnet is : '.$res->results[0]->subnet[0].'/'.$res->results[0]->subnet[1]);
} catch (Exception $e) {
	echo('Handle error : '.$e->getMessage());
}

// Get an address object named OBJ_IP in 'root' ADOM
try {
	$res = $policyManager->getOneAdomObjectFirewallAddress('root', 'OBJ_IP');
	echo('Subnet is : '.$res->results[0]->subnet[0].'/'.$res->results[0]->subnet[1]);
} catch (Exception $e) {
	echo('Handle error : '.$e->getMessage());
}

// Add a new address object in the global database
// Define the object
$ip = new stdClass;
$ip->name = 'OBJ_IP';
$ip->type = 'ipmask';
$ip->subnet = '10.1.1.0/24';

// Send the request to the FortiManager
try {
	$res = $policyManager->addGlobalObjectFirewallAddress($ip);
	echo('Success !');
} catch (Exception $e) {
	echo('Handle error : '.$e->getMessage());
}

// Add a new address object in 'root' ADOM
// Send the request to the FortiManager
try {
	$res = $policyManager->addAdomObjectFirewallAddress('root', $ip);
	echo('Success !');
} catch (Exception $e) {
	echo('Handle error : '.$e->getMessage());
}
```

#### Workspace

[](#workspace)

This library also supports workspace locking. It allows to lock the workspace, make changes and then commit thoses changes or unlock without committing (rollback).

*You have to enable workspace on the FortiManager first.*

```
// Lock workspace ('root' VDOM)
$policyManager->execAdomWorkspaceLock('root');

// Create many IP objects
$error = FALSE;
for ($i=1; $i < 50; $i++) {
	// Define the object
	$ip = new stdClass;
	$ip->name = 'OBJ_IP'.$i;
	$ip->type = 'ipmask';
	$ip->subnet = '10.1.'.$i.'.0/24';

	// Send the request to the FortiManager
	try {
		$res = $policyManager->addGlobalObjectFirewallAddress($ip);
		echo($ip->name.' Success !');
	} catch (Exception $e) {
		echo('Handle error : '.$e->getMessage());
	}
}

// Check error
if ($error === FALSE) {
	// No errors, commit changes
	$policyManager->execAdomWorkspaceCommit('root');
} else {
	// Errors, abort and rollback
	$policyManager->execAdomWorkspaceUnlock('root');
}
```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1851d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3b52a5a1fcfa2dc90b63bb0d58114fe8bae432ede9797ef52cb5579859910b44?d=identicon)[benclerc](/maintainers/benclerc)

---

Top Contributors

[![benclerc](https://avatars.githubusercontent.com/u/79925489?v=4)](https://github.com/benclerc "benclerc (2 commits)")

---

Tags

firewallfirewall-managementfortimanagerfortinetfortinet-firewall

### Embed Badge

![Health badge](/badges/benclerc-fortinet-fortimanagerapi/health.svg)

```
[![Health](https://phpackages.com/badges/benclerc-fortinet-fortimanagerapi/health.svg)](https://phpackages.com/packages/benclerc-fortinet-fortimanagerapi)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M475](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M270](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M186](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M33](/packages/facebook-php-business-sdk)[microsoft/microsoft-graph

The Microsoft Graph SDK for PHP

65723.5M95](/packages/microsoft-microsoft-graph)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
