PHP code example of hugsbrugs / php-sftp

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

    

hugsbrugs / php-sftp example snippets



use Hug\Sftp\Sftp as Sftp;

Sftp::test($server, $user, $password, $port = 22, $timeout = 10);

Sftp::is_file($server, $user, $password, $remote_file, $port = 22, $timeout = 10);

Sftp::delete($server, $user, $password, $remote_file, $port = 22, $timeout = 10);

Sftp::rmdir($server, $user, $password, $remote_path, $port = 22, $timeout = 10);

Sftp::upload_dir($server, $user, $password, $local_path, $remote_path, $port = 22, $timeout = 10);

Sftp::download($server, $user, $password, $remote_file, $local_file, $port = 22, $timeout = 10);

Sftp::download_dir($server, $user, $password, $remote_dir, $local_dir, 
$port = 22, $timeout = 10);

Sftp::rename($server, $user, $password, $old_file, $new_file, $port = 22, $timeout = 10);

Sftp::mkdir($server, $user, $password, $directory, $port = 22, $timeout = 10);

Sftp::touch($server, $user, $password, $remote_file, $content, $port = 22, $timeout = 10);

Sftp::upload($server, $user, $password, $local_file, $remote_file = '', $port = 22, $timeout = 10);

Sftp::scandir($server, $user, $password, $path, $port = 22, $timeout = 10);

Sftp::pwd($server, $user, $password, $port = 22, $timeout = 10);

php example/test.php

composer