dev-master
9999999-devLibrary for transfering files via SSH2
GPL-3.0
The Requires
- monolog/monolog ^1.23
- ext-ssh2 *
file ssh transfer
Wallogit.com
2017 © Pedro Peláez
Library for transfering files via SSH2
A SSH2 client written in PHP, (*1)
You may choose between the authentication modes pubkey, password and none., (*2)
$auth = new PasswordAuthentication("vagrant", "vagrant");
$auth = new PublicKeyAuthentication("vagrant", "/path/to/id_rsa.pub", "/path/to/id_rsa", "keypassword");
$auth = new NoneAuthentication("vagrant");
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);
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);
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');
Library for transfering files via SSH2
GPL-3.0
file ssh transfer