https://github.com/bashkarev/ssh
https://github.com/bashkarev/ssh
ssh ssh-client
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/bashkarev/ssh
- Owner: bashkarev
- License: mit
- Created: 2017-10-25T20:31:59.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-10-30T21:19:51.000Z (over 8 years ago)
- Last Synced: 2026-01-01T14:37:12.346Z (5 months ago)
- Topics: ssh, ssh-client
- Language: PHP
- Size: 13.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Native ssh client
=================
status: in progress
[](https://travis-ci.org/bashkarev/ssh)
Installation
------------
The preferred way to install this extension is through [composer](http://getcomposer.org/download/).
Either run
```
composer require bashkarev/ssh
```
## Usage
```php
$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();
```