ourren / yii2-ssh2
为yii2的SSH2库
0.1.1
2016-05-24 02:52 UTC
Requires
- php: >=5.4.0
- phpseclib/phpseclib: 2.0.*
- yiisoft/yii2: *
This package is not auto-updated.
Last update: 2024-09-26 00:50:00 UTC
README
基于phpseclib的纯PHP库小部件(基于Yii2)。
安装
安装此扩展的首选方法是使用composer。
运行以下命令之一:
composer require ourren/yii2-ssh2 "*"
或者将以下内容添加到你的composer.json
文件的require部分:
"ourren/yii2-ssh2": "*"
用法
示例
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;
});
}
参考
该项目基于thelfensdrfer/yii2sshconsole进行修改。