Pure PHP library widget (based on phpseclib) for Yii2.
modified for integrity and fix confilict with Yii2
by : Behnam mirzaee
The preferred way to install this extension is through composer.
Either run
composer require behnampro/yii2-ssh2 "*"
or add
"behnampro/yii2-ssh2": "*"
to the require section of your composer.json
file.
use behnampro\yii2ssh\Yii2ssh;
$yii_ssh = new Yii2ssh();
$host = "127.0.0.1";
$auth['username'] = 'admin';
$auth['password'] = 'password';
if($yii_ssh->connect($host, $auth))
{
$yii_ssh->run_ssh([
'ls -al',
], function($line) {
echo $line;
});
}
The project is modified based on thelfensdrfer/yii2sshconsole