bashkarev / ssh
dev-master
2017-10-30 21:19 UTC
Requires
- php: >=5.6
Requires (Dev)
- phpunit/phpunit: ^5.7
This package is not auto-updated.
Last update: 2025-01-09 06:53:02 UTC
README
status: in progress
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();