1. Go to this page and download the library: Download luka/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/ */
luka / php-ssh example snippets
// simple configuration to connect "my-host"
$configuration = new Ssh\HostConfiguration('my-host');
// ... the configuration creation
$session = new Ssh\Session($configuration);
$configuration = new Ssh\HostConfiguration('myhost');
$authentication = new Ssh\Authentication\Password('John', 's3cr3t');
$session = new Session($configuration, $authentication);
$configuration = Ssh\OpenSSH\ConfigFile::fromHostname('my-host');
$session = new Ssh\Session($configuration, $configuration->createAuthenticationMethod());
// the session creation
$sftp = $session->getSftp();
// ... the session creation
$publickey = $session->getPublickey();