shanemcc/phprouter
Composer 安装命令:
composer create-project shanemcc/phprouter
包简介
PHP Scripts for interacting with network devices
README 文档
README
Provides a library designed to allow reading/writing data to/from multiple types of network-device via PHP to aid in automation.
It was originally designed just for reading data from routers in scripts but evolved to support other device types and usages.
Supported Devices
| Device Type | Telnet? | SSH? |
|---|---|---|
| HP Procurve | ✅ | ✅ |
| Cisco IOS | ✅ | ✅ |
| Cisco IOSXR | ✅ | ✅ |
| ArborOS | ❌ | ✅ |
| APC PDU | ✅ | ❌ |
Currently, support is limited to what I have access to. If you want support for something that isn't, then please feel free to submit a pull-request, or provide access to the device in question. (Read-Only should be sufficient in most cases.)
Usage
Usage is simple, clone the repo into a subfolder, run git submodule update --init to pull in the submodules and then include('phprouter/PHPRouter.php'); and begin using.
Example usage:
<?php use ShaneMcC\PhpRouter\Implementations\CiscoRouter; $router = new CiscoRouter('192.168.0.1', 'admin', 'password'); $router->connect(); $router->enable('enable'); $config = $router->exec('show run'); $router->disconnect(); echo $config; ?>
Further more in-depth example usage is documented on the wiki
Some of the router types have helper functions (ie, the ones I've needed!), eg ArborOS has saveConfig($logMessage) and hasPendingConfig(), and IOS/IOSXR devices have getPrefixList($name, $type)
If you are using ssh-based routers, you will need the ssh2 module for php.
Debian / Ubuntu
apt-get install libssh2-php
Redhat / CentOS
yum install php-pecl-ssh2
Other
pecl install ssh2
Comments, Bugs, Feature Requests etc.
Bugs and Feature Requests should be raised on the issue tracker on github. I'm happy to recieve code pull requests via github.
Comments can be emailed to shanemcc@gmail.com
统计信息
- 总下载量: 1.92k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 9
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-06-27