ourren/yii2-ssh2

SSH2 library for yii2

0.1.1 2016-05-24 02:52 UTC

This package is not auto-updated.

Last update: 2024-05-08 22:58:12 UTC


README

Latest Stable Version Total Downloads Latest Unstable Version License

Pure PHP library widget (based on phpseclib) for Yii2.

Installation

The preferred way to install this extension is through composer.

Either run

composer require ourren/yii2-ssh2 "*"

or add

"ourren/yii2-ssh2": "*"

to the require section of your composer.json file.

Usage

Example

use ourren\yii2ssh\Yii2ssh;
$yii_ssh = new Yii2ssh();
$host = "127.0.0.1";
$auth['username'] = 'root';
$auth['password'] = 'root';
if($yii_ssh->connect($host, $auth))
{
    $yii_ssh->run([
        'ls -al',
    ], function($line) {
        echo $line;
    });
}

Ref

The project is modified based on thelfensdrfer/yii2sshconsole