1. Go to this page and download the library: Download ocolin/hyconext 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/ */
ocolin / hyconext example snippets
$snmp = new HyconextSNMP();
$ssh = new HyconextSSH();
$config = new Config( prefix: 'SWITCH_FLOOR2' );
$snmp = new HyconextSNMP( $config );
$config = new Config( host: '192.168.1.1', community: 'public' );
$snmp = new HyconextSNMP( $config );
use Ocolin\Hyconext\HyconextSNMP;
use Ocolin\EasySNMP\Config;
// Using environment variables
$snmp = new HyconextSNMP();
// Using a config object directly
$config = new Config(
host: '192.168.1.1',
community: 'public',
prefix: 'HYCONEXT'
);
$snmp = new HyconextSNMP( $config );
// Get system information
$system = $snmp->getSystem();
echo $system->sysName; // 877Cedar.POESW
echo $system->sysUpTime; // Raw TimeTicks value
echo $system->sysLocation; // 877Cedar
// Get interfaces (default columns)
$interfaces = $snmp->getInterfaces();
foreach( $interfaces as $port ) {
echo $port->name . ' - ' . $port->alias . ' - ' . $port->operStatus;
}
// Get interfaces (specific columns only)
$interfaces = $snmp->getInterfaces(['name', 'alias', 'operStatus', 'highSpeed']);
// Get POE data (all columns)
$poe = $snmp->getPoe();
foreach( $poe as $port ) {
echo $port->label . ': ' . $port->currentPower . 'mW';
}
// Get POE data (specific columns only)
$poe = $snmp->getPoe(['adminEnable', 'detection', 'currentPower', 'label']);
use Ocolin\Hyconext\HyconextSSH;
use Ocolin\Hyconext\SshConfig;
// Using environment variables
$ssh = new HyconextSSH();
// Using a config object directly
$config = new SshConfig(
host: '192.168.1.1',
password: 'yourpassword'
);
$ssh = new HyconextSSH( $config );
// Get MAC address table
$macTable = $ssh->getMacTable();
echo $macTable->macStats->total; // Total MAC addresses
echo $macTable->macStats->dynamic; // Dynamic entries
echo $macTable->macStats->static; // Static entries
foreach( $macTable->macTable as $entry ) {
echo $entry->mac . ' on ' . $entry->interface . ' (VLAN ' . $entry->vlan . ')';
}
$port->interface; // Name of the interface port.
$port->adminStatus; // Administrative status.
$port->operStatus; // Operational status.
$port->mode; // Interface mode.
$port->description; // Description of port
$poe->index; // int - Interface index (matches Port index)
$poe->adminEnable; // ?int - 1=enabled, 2=disabled
$poe->detection; // ?int - 1=disabled, 2=searching, 3=deliveringPower, 4=fault
$poe->currentPower; // ?int - Current consumption in milliwatts
$poe->peakPower; // ?int - Peak consumption in milliwatts
$poe->maxPower; // ?int - Configured power limit in milliwatts
$poe->voltage; // ?int - Port voltage in volts
$poe->currentMa; // ?int - Current draw in milliamps
$poe->label; // ?string - POE port label
$system->sysName; // ?string - Device hostname
$system->sysDescr; // ?string - Hardware/firmware description
$system->sysLocation; // ?string - Physical location
$system->sysContact; // ?string - Contact information
$system->sysUpTime; // ?int - Uptime in TimeTicks (hundredths of a second)
$macTable->macStats->total; // int - Total MAC entries
$macTable->macStats->dynamic; // int - Dynamic entries
$macTable->macStats->static; // int - Static entries
$macTable->macStats->valid; // int - Valid entries
foreach( $macTable->macTable as $entry ) {
$entry->mac; // string - MAC address (xx:xx:xx:xx:xx:xx)
$entry->interface; // string - Interface name
$entry->vlan; // ?int - VLAN ID
$entry->operType; // string - Operation type (forward, discard, etc.)
$entry->type; // string - Entry type (dynamic, static, etc.)
$entry->vsi; // ?string - Virtual Switch Instance (null if not used)
$entry->bd; // ?string - Bridge Domain (null if not used)
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.