定制 edvnetwork/php-ssh 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

edvnetwork/php-ssh

最新稳定版本:2.1

Composer 安装命令:

composer require edvnetwork/php-ssh

包简介

PHP sdk for connect to servers via ssh, sftp an more.

README 文档

README

A PHP sdk for connect to servers via ssh, sftp an more.

Dependencies

  • PHP >= 7.4

Setup

If you already have a file, just add the following dependency to your project: composer.json

"require": {
    "edvnetwork/php-ssh": "^2.1"
}

With the dependency added to , just run: composer.json

composer install

Alternatively, you can run directly in your terminal:

composer require edvnetwork/php-ssh

SSH connection with simple user and password authentication

<?php
  use EDV\net\ssh\SSHConnection;
  use EDV\net\ssh\auth\SSHPasswordAuthentication;

  $ssh = new SSHConnection();
  $ssh->open('127.0.0.1');
  $ssh->authenticate(
    new SSHPasswordAuthentication('user', 'password'));

  $directoryIterator = $ssh->getDirectoryIterator('/temp');

  while ($directoryIterator->valid()) {
    $splFileInfo = $directoryIterator->current();

    if ($splFileInfo->isFile()) {
        $splFileObject = $directoryIterator->openFile('r');
    }

    $directoryIterator->next();
}

SSH connection with user's public key

<?php
  use EDV\net\ssh\SSHConnection;
  use EDV\net\ssh\auth\SSHPublicKeyAuthentication;

  $ssh = new SSHConnection();
  $ssh->open('example.com');
  $ssh->authenticate(new SSHPublicKeyAuthentication('user', '/home/user/.ssh/id_rsa.pub', '/home/user/.ssh/id_rsa', 'passphrase'));

  $directoryIterator = $ssh->getDirectoryIterator('/temp');

  while ($directoryIterator->valid()) {
    $splFileInfo = $directoryIterator->current();

    if ($splFileInfo->isFile()) {
        $splFileObject = $directoryIterator->openFile('r');
    }

    $directoryIterator->next();
}

统计信息

  • 总下载量: 6
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-07-24

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固