Download the PHP package epiecs/phpmiko without Composer
On this page you can find all versions of the php package epiecs/phpmiko. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download epiecs/phpmiko
More information about epiecs/phpmiko
Files in epiecs/phpmiko
Package phpmiko
Short Description Netmiko alternative written in PHP.
License MIT
Homepage https://github.com/epiecs/phpmiko
Informations about the package phpmiko
PhpMiko
<3 NetMiko but I'm a php developer. So I've decided to build a php alternative
Mad respect to Kirk Byers for creating netmiko and being a huge inspiration to this project.
To hit the ground running check out the Quickstart example.
Requires:
- Php >= 7.1
Installation:
Supported devices
Implemented
- Aruba
- Cisco ios
- Cisco nx-os
- HPE Comware
- Juniper Junos
Planned
- Avaya
- Linux
- Vyos
- Checkpoint
- ...
Supported protocols
- ssh
- telnet
Contents
- PhpMiko
- Requires:
- Installation:
- Supported devices
- Implemented
- Planned
- Supported protocols
- Contents
- Examples:
- Quickstart example
- Connecting to a device
- Sending commands
- Sending one command as string
- Sending one command as an array
- Sending multiple commands
- Output
- Command types
- cli
- operation
- configure
- Device types and command mapping
- Cleaning up and debugging
- Setting raw mode
- Closing the connection
- Suggestions
- Contributions and thanks
Examples:
Quickstart example
Connecting to a device
When the raw flag is set to true PhpMiko will not clean up output and return it as is (minus a few hidden characters so you at least get all textual output).
secret is used when a runlevel requires a different password. Like for example enable mode (privileged exec) in Cisco ios. You would put the enable password in the secret field.
verbose when set to true all sent and received raw packets will be ouput for debugging purposes.
For a list of all __device_types__ refer to Device types and command mapping.
Sending commands
When sending commands you can either provide a string or an array. Either way is fine. When providing an array the commands are run in order.
In these examples the command type operation
is used. For all command types check out Command types.
Sending one command as string
Sending one command as an array
Sending multiple commands
Output
All output will be returned as an array where the key is the command that was run
Command types
PhpMiko has 3 distinct mechanisms to send commands:
cli
operation
configure
All commands are run sequentially and chained. However this is only per set of supplied commands.
Even though PhpMiko has 3 mechanisms not all are implemented on each device. Some devices only have 1 or 2 configuration tiers. For an overview please refer to Device types and command mapping.
cli
Runs one or more cli commands on a device. Eg. the standard linux cli in junos or user exec mode in cisco ios
operation
Runs one or more operational/enable commands on a device. Eg. cli (operational) mode in junos or privileged exec mode in cisco ios
configure
Sends one or more configuration commands to the device. Eg. configuration mode in junos or global configuration (configure terminal) in cisco ios
Device types and command mapping
Vendor | Device | device_type | cli | operation | configure |
---|---|---|---|---|---|
Aruba | Aruba | aruba | user exec | privileged exec | configure terminal |
Cisco | Cisco ios | cisco_ios | user exec | privileged exec | configure terminal |
Cisco nxos | cisco_nxos | user exec | user exec | configure terminal | |
Juniper | Junos | junos | linux cli 1 | operational mode | configuration mode |
HP | HPE Comware | comware | user exec | user exec | system-view |
1: Only works when using the root account
Cleaning up and debugging
Setting raw mode
Defaults to true when calling the function.
Closing the connection
Suggestions
The underlaying library for ssh connections is phpseclib. They recommend the following php extensions for a nice speed boost when using ssh:
- ext-libsodium
- ext-openssl
- ext-mcrypt
- ext-gmp
These extensions are not required.