2017 © Pedro Peláez
 

library php-interactive-ssh

Provide an interactive ssh connection.

image

rannk/php-interactive-ssh

Provide an interactive ssh connection.

  • Friday, November 7, 2014
  • by rannk
  • Repository
  • 1 Watchers
  • 0 Stars
  • 9 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

PHP INTERACTIVE SSH

provide an interactive ssh connection., (*1)

requirements

You need PHP version 5.3+ with the SSH2 extension., (*2)

Installation

The best way to add the library to your project is using composer., (*3)

$ composer require rannk/php-interactive-ssh:dev-master

Usage

This wraaper tool is very eash to use. But now we just provide using username and password to access the ssh connection., (*4)

How to use it

step 1: instance a connection object, (*5)

<?php
$conn = new ssh\Connection(hostname, [port]);
$conn->authByPassword(username, password);

setp 2: create a session, (*6)

<?php
$session = $conn->createSession();

setp 3: send your command, (*7)

<?php
$session->expect('$');
$session->send('ls');
$session->expect('$');

method explain

session::expect(expect_word, expire_time, display_message) return String, (*8)

expect_word(String):  which word you expected waiting for when you want to run next command

expire_time(int): The default is 0. set the waiting for time. The zero mean always wait.

display_message(boolean): To set true is mean display the output message that from command. 

session::send(command) return void, (*9)

command(String): The shell command

The Versions

07/11 2014

dev-master

9999999-dev

Provide an interactive ssh connection.

  Sources   Download

MIT

The Requires

 

ssh ssh2 interactive