1. Go to this page and download the library: Download faudin/php-ssh library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
faudin / php-ssh example snippets
// simple configuration to connect "my-host"
$configuration = new Ssh\Configuration('my-host');
// simple configuration to connect "my-host"
$configuration = new Ssh\SshConfigFileConfiguration('/Users/username/.ssh/config', 'my-host');
$authentication = $configuration->getAuthentication('optional_passphrase', 'optional_username');
// ... the configuration creation
$session = new Ssh\Session($configuration);
$configuration = new Ssh\Configuration('myhost');
$authentication = new Ssh\Authentication\Password('John', 's3cr3t');
$session = new Session($configuration, $authentication);
$configuration = new Ssh\SshConfigFileConfiguration('~/.ssh/config', 'my-host');
$session = new Session($configuration, $configuration->getAuthentication());
// the session creation
$sftp = $session->getSftp();
// the session creation
$scp = $session->getScp();
$scp->send('local/path/to/file','remote/path/where/send/file');
$scp->receive('remote/path/to/file','local/path/where/save/file');
// ... the session creation
$publickey = $session->getPublickey();