daanwilson / php-sftp-client
A SFTP extension for the php-ftp-client library from Nicolas (nicolab/php-ftp-client).
Requires
- php: >=5.4
- ext-ftp: *
- ext-openssl: *
- nicolab/php-ftp-client: ^2.0
README
A SFTP extension for the library of Nicolab/php-ftp-client. This lib provides helpers easy to use to manage the remote files through SFTP. When you want to use this library/extension, be sure that OpenSSL and ssh2_connect is enabled on the server. Else it will throw an error when you want to connect to a server through SFTP. Most FTP functions are also compatible with SFTP.
Install
- Install package with composer
composer require daanwilson/php-sftp-client
- Or use GIT clone command:
git clone git@github.com:daanwilson/php-sftp-client.git
Getting Started
Connect to a server SFTP (on port 22 or another port) :
$ftp = new \SfpClient\SftpClient(); $ftp->connect($host, true, 22); $ftp->login($login, $password);
Note: The connection is implicitly closed at the end of script execution (when the object is destroyed). Therefore it is unnecessary to call $ftp->close()
, except for an explicit re-connection.
API doc
See the source code for more details.
License
MIT c) 2024, Daan Wilson.
Author
![Daan Wilson - daanwilson.nl] |
---|
Daan Wilson |