r3n0e0/ssh-config

A ssh config parser for PHP

0.1.0 2017-07-20 10:00 UTC

This package is not auto-updated.

Last update: 2024-04-28 01:17:57 UTC


README

A ssh config parser in PHP

Build Status

Example

use SshConfig\Config;
$config = Config::parse(file_get_contents('<filepath>'));
var_dump($config);
Result:

array(2) {
  [0] =>
  array(2) {
    'Host' =>
    string(5) "hello"
    'Config' =>
    array(4) {
      'HostName' =>
      string(11) "example.com"
      'User' =>
      string(3) "wow"
      'Port' =>
      string(2) "22"
      'IdentityFile' =>
      string(19) "~/.ssh/id_rsa_hello"
    }
  }
  [1] =>
  array(2) {
    'Host' =>
    string(1) "*"
    'Config' =>
    array(3) {
      'PasswordAuthentication' =>
      string(2) "no"
      'ChallengeResponseAuthentication' =>
      string(2) "no"
      'HashKnownHosts' =>
      string(3) "yes"
    }
  }
}

License

MIT