PHPackages                             ady21kurniawan/sftp21 - 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. ady21kurniawan/sftp21

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

ady21kurniawan/sftp21
=====================

v1.0.0(1y ago)014PHP

Since Dec 15Pushed 1y ago1 watchersCompare

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

READMEChangelogDependencies (2)Versions (3)Used By (0)

How To use Sftp21
-----------------

[](#how-to-use-sftp21)

**Configuration :**

```
$config = [
    'host' => "",
    'port' => "", // optional: default is 22
    'username' => "",
    'password' => "",
    'root' => "",
    'timeout' => "" // optional: default is 30
];

$sftp_21 = new \Ady21kurniawan\Sftp21\Sftp21($config);

```

#### Connection test :

[](#connection-test-)

```
$sftp_21 = new Sftp21($config);
sftp_21->isConnected(); // returning boolean

```

Working with filesytem
----------------------

[](#working-with-filesytem)

```
$filesystem = new \League\Flysystem\Filesystem($sftp_21);

```

*noted : Now all interface function will be implemented*

Lists Functions
---------------

[](#lists-functions)

*1. give information for connection status*

```
$sftp_21->connectionStatus();

```

*2. give your working directory that you setting in Configuration*

```
$sftp_21->workdir();

```

*3. Download File*

```
$sftp_21->downloadFile($pathFileRemote, $localPath);

```

*4. Get Mime Type File*

```
$sftp_21->getMimetype($path);  // returning an array [ "mimetype" =>  ]

```

```
$filesystem->getMimetype($path);  // returning

```

*5. Get Metadata file*

```

$sftp_21->getMetadata($pathFileRemote);

or

$filesystem->getMetadata($pathFileRemote);

// returning an array assoc of metadata

```

*6. Get Timestamp file*

```
$sftp_21->getTimestamp($pathFileRemote); // returning an array  ["timestamp" => ]

```

```
$filesystem->getTimestamp($pathFileRemote); // returning last access file timestamp

```

*7. set File Visibility*

```
$sftp_21->setVisibility($pathFileRemote, $octal_number);

or

$filesystem->setVisibility($pathFileRemote, $octal_number);

//returning boolean;
noted : set args octal_number with octal number , example : instead '0644' you have to set 0644

```

*8. get File Visibility*

```
$sftp_21->getVisibility($pathFileRemote); // returning an array assoc of metadata file with info Visibility

```

```
$filesystem->getVisibility($pathFileRemote); // returning public or private

```

*9. get File Info*

```
$sftp_21->getFileInfo($pathFileRemote); // returning metadata's file

```

*10. get File Size*

```
$sftp_21->getSize($pathFileRemote);

or

$filesystem->getSize($pathFileRemote);

// returning filesize on byte

```

*11. Moving File*

```
$sftp_21->move($pathFile, $destinationDirectory);
//returning boolean

Note : default $destinationDirectory is '/' and only directory, you dont have permit to give new file name

example : $sftp_21->move('remote_file/example.csv', 'remote_file/move')

```

*12. Renaming File*

```
$sftp_21->rename($path, $newpath);

or

$filesystem->rename($path, $newpath);

//returning boolean
Note : file should be same in one folder

```

*13. Update Content File*

```
$sftp_21->update($path, $contents, $visibility );

or

$filesystem->update($path, $contents, $visibility);

//returning boolean
Note : update process will be replacing contents, and visibility is optional, if you want to set visibility , set with octal number (example : 0644 not '0644')

```

*14. Update Content File (Stream)*

```
$sftp_21->updateStream($path, $resource, $visibility );

or

$filesystem->updateStream($path, $resource, $visibility);

//returning boolean
Note : same with update, diference is resource is should be Stream data, you can use function getDataStreamBiner or getDataStream

```

*14. Copy File*

```
$sftp_21->copy($path, $newpath);

or

$filesystem->copy($path, $newpath);

//returning boolean

```

*15. remove Directory*

```
$sftp_21->deleteDir($path_dir);

or

$filesystem->deleteDir($path_dir);

//returning boolean

note: directory only can be deleted, if directory is empty. make sure directory is empty

```

*16. Create Directory*

```
$filesystem->createDir($path_dir, $recursive);

or

$sftp_21->createDir($path_dir, $recursive);

//returning boolean

note : recursive set default is false

```

*17. Delete File*

```
$filesystem->delete($path_file);

or

$sftp_21->delete($path_file);

//returning boolean

```

*18. Read File Stream*

```
$filesystem->readStream($path_file);
//returning a stream file

```

```
$sftp_21->readStream($path_file);

//returning an array assoc ["stream" =>  ]

```

*19. Read File*

```
$filesystem->read($path_file);
//returning a stream file

```

```
$sftp_21->read($path_file);

//returning an array assoc ["contents" =>  ]

```

*20. Check File is Exists*

```
$filesystem->has($path_file);

or

$sftp_21->has($path_file);

//returning boolean

```

*21. Get List Files*

```
$filesystem->listContents($path_directory);

or

$sftp_21->listContents($path_directory);

//returning an array of list files

```

*22. write file*

```
$contents = 'This is a local file content yooo!';
$filesystem->write($path_file, $contents);

or

$contents = 'This is a local file content yooo!';
$sftp_21->write($path_file, $contents);

//returning boolean

```

*23. write file stream*

```
$contents = 'This is a local file content yooo!';
// convert to stream
$resource_stream = $sftp_21->getDataStream($contents);

$filesystem->writeStream($path_file, $resource_stream);

or

$contents = 'This is a local file content yooo!';
// convert to stream
$resource_stream = $sftp_21->getDataStream($contents);

$sftp_21->writeStream($path_file, $resource_stream);

//returning boolean

```

*24. get Data Stream*

```
$contents = 'This is a local file content yooo!';
$sftp_21->getDataStream($contents); // returning stream data

```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance40

Moderate activity, may be stable

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity39

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

513d ago

### Community

Maintainers

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

---

Top Contributors

[![ady21kurniawan](https://avatars.githubusercontent.com/u/23519232?v=4)](https://github.com/ady21kurniawan "ady21kurniawan (1 commits)")

### Embed Badge

![Health badge](/badges/ady21kurniawan-sftp21/health.svg)

```
[![Health](https://phpackages.com/badges/ady21kurniawan-sftp21/health.svg)](https://phpackages.com/packages/ady21kurniawan-sftp21)
```

###  Alternatives

[league/flysystem-aws-s3-v3

AWS S3 filesystem adapter for Flysystem.

1.6k263.6M790](/packages/league-flysystem-aws-s3-v3)[unisharp/laravel-filemanager

A file upload/editor intended for use with Laravel 5 to 10 and CKEditor / TinyMCE

2.2k3.3M74](/packages/unisharp-laravel-filemanager)[league/flysystem-sftp-v3

SFTP filesystem adapter for Flysystem.

6129.6M91](/packages/league-flysystem-sftp-v3)[league/flysystem-bundle

Symfony bundle integrating Flysystem into Symfony applications

40029.5M87](/packages/league-flysystem-bundle)[league/flysystem-memory

In-memory filesystem adapter for Flysystem.

8533.6M194](/packages/league-flysystem-memory)[yii2-starter-kit/yii2-file-kit

Yii2 file upload and storage kit

151216.8k6](/packages/yii2-starter-kit-yii2-file-kit)

PHPackages © 2026

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