dev-master 2017-10-30 21:19 UTC

This package is not auto-updated.

Last update: 2024-04-18 03:41:00 UTC


README

status: in progress

Build Status

Installation

The preferred way to install this extension is through composer.

Either run

composer require bashkarev/ssh

Usage

$client = new \Bashkarev\Ssh\Client('127.0.0.1');
$client
    ->setPort(22)
    ->setUser('ssh_user')
    ->setIdentityFile('path/to/private_key')
    ->setForwardAgent(true);

/**
 * @var \Bashkarev\Ssh\Command $command
 */
$command = $client->exec('php -v', 360, 60);
foreach ($command->getIterator() as $type => $data) {
    if ($command::OUT === $type) {
        echo "\nRead from stdout: " . $data;
    } else { // $command::ERR === $type
        echo "\nRead from stderr: " . $data;
    }
}

$command->getExitCode();