Skip to content

ShaneMcC/phprouter

Repository files navigation

PHPRouter

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 [email protected]

About

PHP Scripts for interacting with network devices.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages