2017 © Pedro Peláez
 

library php-sftp

PHP SFTP Utilities

image

hugsbrugs/php-sftp

PHP SFTP Utilities

  • Tuesday, March 21, 2017
  • by hugsbrugs
  • Repository
  • 1 Watchers
  • 0 Stars
  • 4,178 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 3 Versions
  • 26 % Grown

The README.md

php-sftp

PHP SFTP Utilities, (*1)

If you also need FTP : php-ftp, (*2)

Dependencies :

phpseclib : Github - Documentation - Examples, (*3)

Install

Install package with composer, (*4)

composer require hugsbrugs/php-sftp

In your PHP code, load librairy, (*5)

require_once __DIR__ . '/vendor/autoload.php';
use Hug\Sftp\Sftp as Sftp;

Usage

Test SFTP connection, (*6)

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

Check if a file exists on SFTP Server, (*7)

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

Delete a file on remote FTP server, (*8)

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

Recursively deletes files and folder in given directory (If remote_path ends with a slash delete folder content otherwise delete folder itself), (*9)

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

Recursively copy files and folders on remote SFTP server (If local_path ends with a slash upload folder content otherwise upload folder itself), (*10)

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

Download a file from remote SFTP server, (*11)

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

Download a directory from remote FTP server (If remote_dir ends with a slash download folder content otherwise download folder itself), (*12)

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

Rename a file on remote SFTP server, (*13)

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

Create a directory on remote SFTP server, (*14)

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

Create a file on remote SFTP server, (*15)

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

Upload a file on SFTP server, (*16)

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

List files on SFTP server, (*17)

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

Get default login SFTP directory aka pwd, (*18)

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

Tests

Edit example/test.php with your FTP parameters then run, (*19)

php example/test.php

To Do

PHPUnit Tests, (*20)

Author

Hugo Maugey visit my website ;), (*21)

The Versions

21/03 2017

dev-master

9999999-dev

PHP SFTP Utilities

  Sources   Download

The Requires

 

21/03 2017

1.0

1.0.0.0

PHP SFTP Utilities

  Sources   Download

The Requires

 

20/03 2017

0.2

0.2.0.0

PHP SFTP Utilities

  Sources   Download

The Requires