Download the PHP package detain/cisco_parser without Composer
On this page you can find all versions of the php package detain/cisco_parser. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package cisco_parser
Cisco Parser
Cisco IOS communications and configuration-parsing library for PHP. Provides:
Detain\CiscoParser\CiscoParser— converts a Cisco IOS running/startup configuration text dump into a nested associative-array tree based on indentation depth.Detain\CiscoParser\CiscoLoader— SSH transport (via PECLssh2) that drives an interactive shell against a real device and parses the output of commonshowcommands (show int status,show int <int>,show log,show arp,show mac address-table,show ipv6 neighbors,show ipv6 routers, DHCP snooping bindings, trunk ports, VLANs, err-disabled, …).
Build Status and Code Analysis
| Site | Status |
|---|---|
![]() |
|
![]() |
|
![]() |
![]() |
![]() |
|
![]() |
|
![]() |
Requirements
- PHP 7.4 or newer
ext-mbstringext-ssh2— only required if you useCiscoLoaderto talk to a real device. The pure-textCiscoParserworks without it.
Installation
Install with Composer:
Usage
Parsing a configuration
CiscoParser::parse_cisco_children() takes an array of lines (typically from
explode("\n", file_get_contents(...)) after stripping \r) and produces a
nested tree where each node has:
command— the first whitespace-delimited token on the linearguments— (optional) anything after the first tokenchildren— (optional) the sub-block of more deeply-indented lines
Output:
Parsing from the command line
A small wrapper script is shipped at bin/cisco_parser.php:
If installed via Composer, the same script is exposed at
vendor/bin/cisco_parser.php.
The wrapper recognises an optional Building configuration... /
Current configuration : N bytes header (as emitted by show running-config)
and pulls the byte count out into the result. Files without that header are
parsed in full.
Talking to a real device
CiscoLoader opens an SSH session and exposes typed helpers around the most
common show commands. It requires the ssh2 PECL extension.
CiscoLoader::exec($cmd) is available for any other command not covered by a
helper; it returns the device's raw response with the trailing prompt stripped.
Testing
For coverage output:
License
The Cisco Parser library is licensed under the LGPL-2.1-only license.








