Download the PHP package detain/sshwitch without Composer
On this page you can find all versions of the php package detain/sshwitch. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download detain/sshwitch
More information about detain/sshwitch
Files in detain/sshwitch
Package sshwitch
Short Description Login and run commands on your network devices via an ssh connection on a remote server. Easy to use PHP static class methods with static chaining support for rapid development. Supports Cisco and Juniper network routers and switches with more easily added.
License GPL-3.0
Informations about the package sshwitch
sshwitch SSH Switch
Login and run commands on your network devices via an ssh connection on a remote server. Easy to use PHP static class methods with static chaining support for rapid development. Supports Cisco and Juniper network routers and switches with more easily added.
We handle the switch login and elevation using rancid and it supports more than what I've adde so far. It would take only a few lines of code to add support to login to devices from Extreme Networks, Juniper, Procket Networks, Redback, A10, Alteon, Avocent (Cyclades), Bay Networks (Nortel), ADC-kentrox, Foundry, HP, Hitachi, Juniper Networks, MRV, Mikrotik, Netscreen, Nokia (Alcatel-Lucent), Netscaler, Riverstone, Netopia, Xirrus, and Arrcus.
Requirements
- PHP 7.4 or later
ssh2
PHP extension- RANCID's
clogin
script for certain network commands (e.g., Cisco devices)
Installation
You can install SSHwitch via Composer:
Usage
Connecting and Executing Commands
Getting and Setting Properties
SSHwitch uses magic methods for getting and setting static properties.
Configuration
The following constants are required for SSHwitch to connect to the switch:
CLOGIN_SSH_HOST
- The SSH host address of the device.CLOGIN_SSH_PORT
- The SSH port to use for the connection.CLOGIN_SSH_USER
- The username for SSH login.CLOGIN_SSH_KEY
- The file path to the SSH private key.
Example Config
Methods
connect()
Connects to the SSH server if not already connected.
disconnect()
Disconnects the current SSH connection.
run($switch, $commands, $type = 'cisco')
Runs commands on the specified switch and returns the output.
Magic Methods
get<PropertyName>()
andset<PropertyName>()
for getting and setting public static properties.
License
This project is licensed under the GNU GPL v3 license.