PHP Classes

PHP SSH2 SFTP Client: Transfer files and run commands with SFTP and SSH

Recommend this page to a friend!

  Author Author  
Name: Suxumi <contact>
Classes: 1 package by
Country: Georgia Georgia


  Detailed description   Download Download .zip .tar.gz  
This package can transfer files and run commands with SFTP and SSH.

It can connect to SSH server and perform operations necessary to execute file transfer operations like creating, listing, renaming and deleting directories, uploading, downloading, renaming, deleting, get status information of files, and creating symbolic links.

The package can also connect to a SSH server and execute given commands.

Details

php-ssh2-sftp-client

PHP Sftp Client Class using SSH2 functions and shell commands, with server-side error handlings

By GR admin@admin.ge

Portfolio<br> GR8cms.com

Copyright (c) 2015 GR<br> licensed under the MIT licenses<br> http://www.opensource.org/licenses/mit-license.html

USAGE

Connect to an SSH server & authenticate:
// initialize
$sftp = new \GR\SftpClient();

// connect
$sftp->connect($host, $port, $timeout);

// login
$sftp->login($user, $pass);

Get current directory:
$sftp->getCurrentDirectory();

Create directory
$sftp->createDirectory($path, $ignore_if_exists);

Delete directory
$sftp->deleteDirectory($path);

Delete file
$sftp->deleteFile($path);

Get directory content list
// just names
$sftp->getDirectoryList($path, $recursive);

// rawlist
$sftp->getDirectoryRawList($path, $recursive);

// <b>formated</b> rawlist
$sftp->getDirectoryRawListFormatted($path, $recursive);

Get file stat
$stat = $sftp->stat($path); 

Download a file
$sftp->downloadFile($remote_file, $local_file); 

Upload a file
$sftp->uploadFile($local_file, $remote_file[, int $create_mode = 0644 ] ); 

Rename file/directory
// Rename File
$sftp->renameFile($oldname, $newname);

// Rename Folder
$sftp->renameDirectory($oldname, $newname);

// both of them are alias of
$sftp->renameFileOrFolder($oldname, $newname);

Create Symlink
$sftp->createSymlink($target, $link); 

Execute custom command
$sftp->ssh2_exec($cmd); 

Close connection
$sftp->close(); 

Handle Errors

try {
	$sftp = new \GR\SftpClient();
	$sftp->connect($host, $port, $timeout);
	$sftp->login($user, $pass);
}
catch(ErrorException $e) {
	// handle the error
}


  Classes of Suxumi  >  PHP SSH2 SFTP Client  >  Download Download .zip .tar.gz  >  Support forum Support forum  >  Blog Blog  >  RSS 1.0 feed RSS 2.0 feed Latest changes  

 

Name: PHP SSH2 SFTP Client
Base name: php-ssh2-sftp-client
Description: Transfer files and run commands with SFTP and SSH
Version: -
PHP version: 5
License: The PHP License
 
  Groups   Applications   Files Files  

  Groups  
Group folder image Networking Networking protocols, clients and servers View top rated classes
Group folder image PHP 5 Classes using PHP 5 specific features View top rated classes
Group folder image Files and Folders Listing, accessing and manipulating files and folders View top rated classes


  Applications that use this package  
No pages of applications that use this class were specified.

Add link image If you know an application of this package, send a message to the author to add a link here.

  Files folder image Files  
File Role Description
Accessible without login Plain text file README.md Doc. Documentation
Plain text file SftpClient.class.php Class Class source

Download Download all files: php-ssh2-sftp-client.tar.gz php-ssh2-sftp-client.zip
NOTICE: if you are using a download manager program like 'GetRight', please Login before trying to download this archive.

For more information send a message to info at phpclasses dot org.