2017 © Pedro Peláez
 

library php-ssh2-client

Library for transfering files via SSH2

image

phizzl/php-ssh2-client

Library for transfering files via SSH2

  • Thursday, September 28, 2017
  • by phizzl
  • Repository
  • 1 Watchers
  • 0 Stars
  • 1 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

SSH2 client

A SSH2 client written in PHP, (*1)

Authentication

You may choose between the authentication modes pubkey, password and none., (*2)

Authentication with password

$auth = new PasswordAuthentication("vagrant", "vagrant");

Authentication with public and private keypair

$auth = new PublicKeyAuthentication("vagrant", "/path/to/id_rsa.pub", "/path/to/id_rsa", "keypassword");

No authentication

$auth = new NoneAuthentication("vagrant");

Creating the SSH2 session

After you configured your authentication you may create the SSH2 session and pass the authentication to it., (*3)

$auth = new PasswordAuthentication("vagrant", "vagrant");
$session = new SshSession("localhost", 22, $auth);

Creating the SSH2 client

Now that you have a session you can create the SSH2 client and pass the session to it., (*4)

$auth = new PasswordAuthentication("vagrant", "vagrant");
$session = new SshSession("localhost", 22, $auth);
$sshClient = new SshClient($session);

Using the SSH2 client

After you created the SSH2 client you are ready to use it., (*5)

$sshClient->sendFile('/local/path/to/file.txt, '~/uploads/file.txt');
$sshClient->receiveFile('~/downloads/remote.file', '/local/path/local.file');
$sshClient->removeFile('~/downloads/remote.file');
$sshClient->createDirectory('~/uploads/newdir');
$sshClient->removeDirectory('~/uploads/newdir', true)
$sshClient->sendDirectory('/local/dir', '~/uploads/newdir');
$sshClient->removeDirectory('~/uploads/newdir', true);
$sshClient->receiveDirectory('~/downloads/backup', '/local/dir/backup');

The Versions

28/09 2017

dev-master

9999999-dev

Library for transfering files via SSH2

  Sources   Download

GPL-3.0

The Requires

 

file ssh transfer