\MrCrankHank\ConsoleAccess\AdaptersSshAdapter

Class SshAdapter

PHP version 5.6

Summary

Methods
Properties
Constants
__construct()
loginPassword()
loginKey()
run()
getOutput()
getExitStatus()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
_login()
$connection
$username
$publicKey
$output
N/A

Properties

$connection

$connection : \phpseclib\Net\SSH2

Type

\phpseclib\Net\SSH2

$username

$username : string

Type

string

$publicKey

$publicKey : string

Type

string

$output

$output : string

Type

string

Methods

__construct()

__construct(  $host,   $username,   $publicKey) 

SshAdapter constructor.

Parameters

$host
$username
$publicKey

Throws

\MrCrankHank\ConsoleAccess\Exceptions\PublicKeyMismatchException

loginPassword()

loginPassword(  $password) 

Login via password

Parameters

$password

loginKey()

loginKey(  $key, null  $password = null) 

Login via private key

Parameters

$key
null $password

run()

run(string  $command, \Closure|null  $live = null) 

Run a command on the remote server.

Parameters

string $command

Command which should be run

\Closure|null $live

Closure to capture the live output of the command

getOutput()

getOutput() : mixed

Return the output of the last command.

Does not work well with long running commands. You should capture the live output instead.

Returns

mixed

getExitStatus()

getExitStatus() : mixed

Return the exist status of the last command

Returns

mixed

_login()

_login(  $auth) 

Login to the server.

Parameters

$auth

Throws

\MrCrankHank\ConsoleAccess\Exceptions\ConnectionNotPossibleException