2017 © Pedro Peláez
 

library console

Console

image

bakhari/console

Console

  • Tuesday, June 28, 2016
  • by bdryagya
  • Repository
  • 1 Watchers
  • 1 Stars
  • 35 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

Console (SSH)

Execute command to remote host using SSH Channel., (*1)

Import Classes

require_once __DIR__ . "/vendor/autoload.php";

use Bakhari\Console\Console;
use Bakhari\Console\Command;
use Bakhari\Console\Streams\FileOutputStream;

use PhanAn\Remote\Remote;
use Illuminate\Config\Repository as ConsoleConfig;

Set up a new Console

$console = new Console(new ConsoleConfig([
    'host'          => '127.0.0.1',
    'port'          => 22,
    'username'      => '<username>',
    'password'      => base64_decode('PHBhc3N3b3JkPg=='),
    'auto_login'    => false,
    'prompt'        => '/[\$>]/',
    'stdout'        => false,
]));

Console's output is sent to stdout by default. Other streams can be added as well. Below we are using FileOutputStream to log the output to /tmp/console, (*2)

$console->pushOutputStream(new FileOutputStream('/tmp/console'));
````

#### Login to Console
If auto_login is disabled, we need to login
```php
$console->login();

To run commands we create a Command Object, and envoke it using run method. Second optional parameter (bool)$dry can be passed for dummy test., (*3)

$console->run(new Command([
    'hostname',
    'cat /etc/passwd',
]));

The Versions

28/06 2016

dev-master

9999999-dev

Console

  Sources   Download

MIT

The Requires

 

by Yagya Chaudhary

04/06 2016

0.0.3

0.0.3.0

Console

  Sources   Download

MIT

The Requires

 

by Yagya Chaudhary

04/06 2016

0.0.2

0.0.2.0

Console

  Sources   Download

MIT

The Requires

 

by Yagya Chaudhary

02/06 2016

0.0.1

0.0.1.0

Console

  Sources   Download

MIT

The Requires

 

by Yagya Chaudhary