PHPackages                             idct/sftp-client - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [File &amp; Storage](/categories/file-storage)
4. /
5. idct/sftp-client

ActiveLibrary[File &amp; Storage](/categories/file-storage)

idct/sftp-client
================

Library that provides wrapper methods around SSH2 and SFTP to simplify file download/upload over SSH/SCP/SFTP.

0.4.3(7y ago)25241.8k—2%9[1 PRs](https://github.com/ideaconnect/idct-sftp-client/pulls)MITPHPPHP &gt;=5.4.0CI failing

Since Jun 4Pushed 2y ago5 watchersCompare

[ Source](https://github.com/ideaconnect/idct-sftp-client)[ Packagist](https://packagist.org/packages/idct/sftp-client)[ Docs](https://github.com/ideaconnect/idct-sftp-client)[ RSS](/packages/idct-sftp-client/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (5)Used By (0)

idct-sftp-client
================

[](#idct-sftp-client)

Library that provides wrapper methods around SSH2, SCP and SFTP to simplify file download/upload over SSH/SCP/SFTP.

warning
=======

[](#warning)

I am still thinking about unification of download / upload methods by passing a parameter which would define the connection type therefore method names may change.

installation
============

[](#installation)

Depending on your project include the files directly or use autoloader.

### Direct usage

[](#direct-usage)

Just include all the required files:

```
include "/path/to/idct/sftp-client/src/AuthMode.php";
include "/path/to/idct/sftp-client/src/Credentials.php";
include "/path/to/idct/sftp-client/src/SftpClient.php";
```

### Composer

[](#composer)

Just execute:

```
composer require idct/sftp-client
```

which will create `vendor` folder with `idct/sftp-client`. Then just include the autoloader:

```
include "vendor/autoload.php";
```

usage
=====

[](#usage)

After you have installed the project import required classes in your project:

```
use IDCT\Networking\Ssh\SftpClient;
use IDCT\Networking\Ssh\Credentials;
```

Initialize instance of the class:

```
$client = new SftpClient();
```

Create authorization mode to your SFTP server:

### When you have username and password:

[](#when-you-have-username-and-password)

```
$credentials = Credentials::withPassword($username, $password);
$client->setCredentials($credentials);
```

### When you have public key:

[](#when-you-have-public-key)

```
$credentials = Credentials::withPublicKey($username, $publicKey, $privateKey, $passphrase = null);
$client->setCredentials($credentials);
```

`$publicKey` and `$privateKey` are paths to respective files.

### Connect to the server

[](#connect-to-the-server)

```
$client->connect($host);
```

### Downloading using SFTP:

[](#downloading-using-sftp)

```
$client->download(ENTER_REMOTE_FILE_NAME);
$client->download(ENTER_REMOTE_FILE_NAME, ENTER_LOCAL_FILE_NAME);
```

### Uploading using SFTP:

[](#uploading-using-sftp)

```
$client->upload(ENTER_LOCAL_FILE_NAME);
$client->upload(ENTER_LOCAL_FILE_NAME, ENTER_REMOTE_FILE_NAME);
```

### Downloading using SCP:

[](#downloading-using-scp)

```
$client->scpDownload(ENTER_REMOTE_FILE_NAME);
```

### Uploading using SCP:

[](#uploading-using-scp)

```
$client->scpUpload(ENTER_LOCAL_FILE_NAME,ENTER_REMOTE_FILE_NAME);
```

### Closing connection:

[](#closing-connection)

```
$client->close();
```

### Remote prefix, local prefix

[](#remote-prefix-local-prefix)

Prefixes set using methods: `setRemotePrefix` and `setLocalPrefix` allow to set common directories for storage. Please follow phpDoc of respective upload/download methods to know when

contribution
============

[](#contribution)

If you find any issues or want to add new features please use the Issues or Pull Request functions: code addition is much appreciated!

Before sending code be sure to run fix\_code.sh to clean it up.

Thanks!

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity45

Moderate usage in the ecosystem

Community17

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 60% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~55 days

Total

4

Last Release

2738d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b76a5fac115d24d698d09cc939a6922bf309732ae61d0f2f215ae9e7397658ea?d=identicon)[ideaconnect](/maintainers/ideaconnect)

---

Top Contributors

[![simmstein](https://avatars.githubusercontent.com/u/520175?v=4)](https://github.com/simmstein "simmstein (6 commits)")[![pedrofornaza](https://avatars.githubusercontent.com/u/1180994?v=4)](https://github.com/pedrofornaza "pedrofornaza (2 commits)")[![ivan-pagac](https://avatars.githubusercontent.com/u/873005?v=4)](https://github.com/ivan-pagac "ivan-pagac (1 commits)")[![uzegonemad](https://avatars.githubusercontent.com/u/430255?v=4)](https://github.com/uzegonemad "uzegonemad (1 commits)")

---

Tags

sshsftpssh2scpidct

###  Code Quality

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/idct-sftp-client/health.svg)

```
[![Health](https://phpackages.com/badges/idct-sftp-client/health.svg)](https://phpackages.com/packages/idct-sftp-client)
```

###  Alternatives

[league/flysystem

File storage abstraction for PHP

13.6k639.1M2.2k](/packages/league-flysystem)[nicolab/php-ftp-client

A flexible FTP and SSL-FTP client for PHP. This lib provides helpers easy to use to manage the remote files.

6435.3M24](/packages/nicolab-php-ftp-client)[creocoder/yii2-flysystem

The flysystem extension for the Yii framework

2931.7M62](/packages/creocoder-yii2-flysystem)[league/flysystem-sftp-v3

SFTP filesystem adapter for Flysystem.

6129.6M91](/packages/league-flysystem-sftp-v3)[yii2mod/yii2-ftp

A flexible FTP and SSL-FTP client for PHP. This lib provides helpers easy to use to manage the remote files.

32433.0k3](/packages/yii2mod-yii2-ftp)[innoge/laravel-rclone

A sleek PHP wrapper around rclone with Laravel-style fluent API syntax

174.1k](/packages/innoge-laravel-rclone)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
