PHP code example of gsu / ftp-sftp-transfer

1. Go to this page and download the library: Download gsu/ftp-sftp-transfer 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/ */

    

gsu / ftp-sftp-transfer example snippets




use Trafficgate\Transferer\Transfer\RsyncTransfer;

$rsync = new RsyncTransfer();
$rsync
    ->source($source, $host = null, $user = null)
    ->destination($destination, $host = null, $user = null)
    ->transfer($idleTimeout = null);



use Trafficgate\Transferer\Transfer\ScpTransfer;

$scp = new ScpTransfer();
$scp
    ->source($source, $host = null, $user = null)
    ->destination($destination, $host = null, $user = null)
    ->transfer($idleTimeout = null);

    $ssh->quietMode($enabled = true)
    

    $ssh->configOptions($value, $remove = false, $enabled = true)
    

    $ssh->host($host)
    

    $ssh->remoteCommand($command)
    



use Trafficgate\Transferer\Ssh\SshCommand;

$ssh = new SshCommand();
$ssh
    ->host($host)
    ->remoteCommand($command);