PHPackages                             benclerc/aruba-switchapi - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. benclerc/aruba-switchapi

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

benclerc/aruba-switchapi
========================

Library used for interacting with Aruba SwitchAPI (ArubaOS).

1.9(4y ago)31.3k2MITPHPPHP &gt;=7.4.0

Since Mar 8Pushed 4y ago1 watchersCompare

[ Source](https://github.com/benclerc/Aruba-SwitchAPI)[ Packagist](https://packagist.org/packages/benclerc/aruba-switchapi)[ Docs](https://github.com/benclerc/Aruba-SwitchAPI)[ RSS](/packages/benclerc-aruba-switchapi/feed)WikiDiscussions master Synced 4d ago

READMEChangelogDependenciesVersions (10)Used By (0)

Aruba SwitchAPI (ArubaOS)
=========================

[](#aruba-switchapi-arubaos)

Aruba SwitchAPI is a PHP library for requesting Aruba switches (ArubaOS). This library can retrieve, create, update and delete configuration on the switch. It wan be used to :

- Configure switch from a PHP designed web interface.
- Backup switch configuration with a PHP script.
- So much more, it is up to you !

**Warning** : This library is incomplete and mainly oriented towards POE, VLAN, port and LED locator. Contributions are welcome !

You can find all supported methods on [Aruba's website](https://h10145.www1.hpe.com/Downloads/ProductsList.aspx), choose your equipment and download the API documentation.

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

[](#table-of-contents)

- [Getting started](#getting-started)
- [Documentation](#documentation)
    - [Config class](#config-class)
    - [SwitchAPI class](#switchapi-class)
        - [Usage](#usage)
        - [Available methods](#available-methods)

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

[](#getting-started)

1. Get [Composer](http://getcomposer.org/).
2. Install the library using composer `composer require benclerc/aruba-switchapi`.
3. Add the following to your application's main PHP file `require 'vendor/autoload.php';`.
4. Instanciate the Config class with the switch's hostname, username and password `$configSwitch = new \Aruba\Config('123.123.123.123', 'admin', 'password');`.
5. Use the Config object previously created to instanciate the SwitchAPI object `$switch = new \Aruba\SwitchAPI($configSwitch);`.
6. Start using the library `$runningConf = $switch->getRunningConfig();`.

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

[](#documentation)

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

### Config class

[](#config-class)

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

1. The switch'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.
- API version : 'v7'. Use `setAPIVersion()` to change (only &gt;= v7 are supported).

Example :

```
// Basic configuration
$configSwitch = new \Aruba\Config('123.123.123.123', 'admin', 'password');

// Configuration for very slow switchs/long requests
$configSwitch = new \Aruba\Config('123.123.123.123', 'admin', 'password');
$configSwitch->setTimeout(20000);

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

// Special API version
$configSwitch = new \Aruba\Config('123.123.123.123', 'admin', 'password');
$configSwitch->setAPIVersion('v8');

// The class logins to the switch when being instanciated hence the try/catch statement.
try {
	$switch = new \Aruba\SwitchAPI($configSwitch);
} catch (Exception $e) {
	echo('Handle error : '.$e->getMessage());
}
```

### SwitchAPI class

[](#switchapi-class)

#### Usage

[](#usage)

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

Examples :

```
// Blink for 1 min LED locator
try {
	$res = $switch->blinkLedLocator(2, 1);
	if ($res) {
		echo('Blink succeeded');
	} else {
		echo('Blink failed');
	}
} catch (Exception $e) {
	echo('Handle error : '.$e->getMessage());
}

// Create a VLAN
try {
	$res = $switch->createVlan(666, 'HELL');
	if ($res) {
		echo('The VLAN has been created.');
	} else {
		echo('Error : the VLAN was not created.');
	}
} catch (Exception $e) {
	echo('Handle error : '.$e->getMessage());
}

// Get status of all ports
try {
	$res = $switch->getPortsStatus();
	if ($res != FALSE) {
		foreach ($res as $key => $value) {
			$status = ($value->is_port_enabled) ? 'up' : 'down';
			echo('Port '.$value->id.' is '.$status.'');
		}
	} else {
		echo('Error : status could not be retrieved.');
	}
} catch (Exception $e) {
	echo('Handle error : '.$e->getMessage());
}

// Set untagged VLAN 666 on port 42
try {
	$res = $switch->setUVlanPort(666, '42');
	if ($res) {
		echo('The VLAN 666 has been affected to the port 42.');
	} else {
		echo('Error : the VLAN was not affected.');
	}
} catch (Exception $e) {
	echo('Handle error : '.$e->getMessage());
}
```

#### Available methods

[](#available-methods)

You can browse all available methods [here](https://benclerc.github.io/Aruba-SwitchAPI/classes/Aruba-SwitchAPI.html).

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity58

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

Every ~18 days

Recently: every ~36 days

Total

9

Last Release

1747d 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 (24 commits)")

---

Tags

arubaaruba-switcharuba-switchapiarubaosarubaos-switchlibrarynetworknetworkingphpphp-libraryswitch

### Embed Badge

![Health badge](/badges/benclerc-aruba-switchapi/health.svg)

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

PHPackages © 2026

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