PHPackages                             php-core/sftp - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. php-core/sftp

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

php-core/sftp
=============

PHP SFTP Utilities

0.0.1(1y ago)0109MITPHPPHP &gt;=8.1

Since Sep 6Pushed 1y agoCompare

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

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

SFTP library for PHP &gt;=8.1
=============================

[](#sftp-library-for-php-81)

PHP SFTP Utilities (PHP &gt;= 8.1)

Based on: [php-sftp](https://github.com/hugsbrugs/php-sftp)

Dependencies :
--------------

[](#dependencies-)

phpseclib : [Github](https://github.com/phpseclib/phpseclib) - [Documentation](https://api.phpseclib.org/master/) - [Examples](http://phpseclib.sourceforge.net/sftp/examples.html)

Install
-------

[](#install)

Install package with composer

```
composer require php-core/sftp

```

In your PHP code, load library

```
require_once __DIR__ . '/vendor/autoload.php';
use PHPCore\SFTP\SFTP;
```

Usage
-----

[](#usage)

Test SFTP connection

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

Check if a file exists on SFTP Server

```
SFTP::isFile($server, $user, $password, $remoteFile, $port = 22, $timeout = 10);
```

Delete a file on remote FTP server

```
SFTP::delete($server, $user, $password, $remoteFile, $port = 22, $timeout = 10);
```

Recursively deletes files and folder in given directory (If remotePath ends with a slash delete folder content otherwise delete folder itself)

```
SFTP::rmdir($server, $user, $password, $remotePath, $port = 22, $timeout = 10);
```

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

```
SFTP::uploadDir($server, $user, $password, $localPath, $remotePath, $port = 22, $timeout = 10);
```

Download a file from remote SFTP server

```
SFTP::download($server, $user, $password, $remoteFile, $localFile, $port = 22, $timeout = 10);
```

Download a directory from remote FTP server (If remoteDir ends with a slash download folder content otherwise download folder itself)

```
SFTP::downloadDir($server, $user, $password, $remoteDir, $localDir,
$port = 22, $timeout = 10);
```

Rename a file on remote SFTP server

```
SFTP::rename($server, $user, $password, $oldFile, $newFile, $port = 22, $timeout = 10);
```

Create a directory on remote SFTP server

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

Create a file on remote SFTP server

```
SFTP::touch($server, $user, $password, $remoteFile, $content, $port = 22, $timeout = 10);
```

Upload a file on SFTP server

```
SFTP::upload($server, $user, $password, $localFile, $remoteFile = '', $port = 22, $timeout = 10);
```

List files on SFTP server

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

Get default login SFTP directory aka pwd

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

Tests
-----

[](#tests)

Edit example/test.php with your FTP parameters then run

```
php example/test.php
```

To Do
-----

[](#to-do)

PHPUnit Tests

License
-------

[](#license)

MIT

Author
------

[](#author)

[PHPCore](https://github.com/php-core)

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance34

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 Bus Factor2

2 contributors hold 50%+ of commits

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

Unknown

Total

1

Last Release

619d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/103283996?v=4)[PHP Core](/maintainers/php-core)[@php-core](https://github.com/php-core)

---

Top Contributors

[![hugsbrugs](https://avatars.githubusercontent.com/u/4385090?v=4)](https://github.com/hugsbrugs "hugsbrugs (7 commits)")[![php-core](https://avatars.githubusercontent.com/u/103283996?v=4)](https://github.com/php-core "php-core (6 commits)")[![lexo13](https://avatars.githubusercontent.com/u/11830742?v=4)](https://github.com/lexo13 "lexo13 (2 commits)")[![mbglytch](https://avatars.githubusercontent.com/u/11628834?v=4)](https://github.com/mbglytch "mbglytch (1 commits)")

### Embed Badge

![Health badge](/badges/php-core-sftp/health.svg)

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

###  Alternatives

[jenssegers/optimus

Id obfuscation based on Knuth's integer hash method

1.3k4.8M27](/packages/jenssegers-optimus)[phpseclib/mcrypt_compat

PHP 5.x-8.x polyfill for mcrypt extension

28029.7M34](/packages/phpseclib-mcrypt-compat)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

728272.9k20](/packages/civicrm-civicrm-core)[phpseclib/bcmath_compat

PHP 5.x-8.x polyfill for bcmath extension

16720.7M17](/packages/phpseclib-bcmath-compat)[codercat/jwk-to-pem

Convert JWK to PEM format.

1004.5M20](/packages/codercat-jwk-to-pem)[salla/zatca

A helper to generate the QR code and signed it for ZATCA e-invoicing

159416.7k2](/packages/salla-zatca)

PHPackages © 2026

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