PHPackages                             lodev09/php-ssh2 - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. lodev09/php-ssh2

ActiveLibrary[HTTP &amp; Networking](/categories/http)

lodev09/php-ssh2
================

Wrapper class for PHP's SSH2 extension.

1.1.0(4y ago)32.6kMITPHPPHP &gt;=5.4

Since Oct 5Pushed 4y ago1 watchersCompare

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

READMEChangelog (4)DependenciesVersions (6)Used By (0)

PHP SSH2
========

[](#php-ssh2)

Wrapper class for PHP's [SSH2 extension](http://php.net/manual/en/book.ssh2.php). The base class was created by [Jamie Munro](https://www.sitepoint.com/author/jmunro/) taken from [this article](https://www.sitepoint.com/using-ssh-and-sftp-with-php/).

Installation
------------

[](#installation)

```
$ composer require lodev09/php-ssh2

```

Usage
-----

[](#usage)

```
// connect
$auth = new \SSH2\Password(SFTP_USER, SFTP_PASSWORD);
$sftp = new \SSH2\SFTP(SFTP_HOST, $auth);

if ($sftp->is_connected() && $sftp->is_authenticated()) {
    // upload
    $sftp->put('/path/to/my/local/file', '/remote/file');

    // download
    $sftp->get('/remote/file', '/local/destination/file');
}
```

### SFTP

[](#sftp)

Common helper methods includes:

- `SFTP::mv` - move remote file
- `SFTP::rm` - delete remote file
- `SFTP::list` - list remote files
- `SFTP::is_dir` - check if path is a directory
- `SFTP::exists` - check if path exists

Other native methods can be called as well for example:

```
// ssh2_sftp_mkdir
$sftp->mkdir(...);
```

### SCP

[](#scp)

Just a pure wrapper of the native `ssh2_scp_xxx` functions.

```
// ssh2_scp_recv
$scp->recv(...);
```

Feedback
--------

[](#feedback)

All bugs, feature requests, pull requests, feedback, etc., are welcome. Visit my site at [www.lodev09.com](http://www.lodev09.com "www.lodev09.com") or email me at

Credits
-------

[](#credits)

- [Jamie Munro](https://www.sitepoint.com/author/jmunro/)
- Jovanni Lo [@lodev09](http://twitter.com/lodev09)

License
-------

[](#license)

Released under the [MIT License](http://opensource.org/licenses/MIT). See [LICENSE](LICENSE) file.

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity60

Established project with proven stability

 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

Every ~307 days

Total

5

Last Release

1552d ago

### Community

Maintainers

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

---

Top Contributors

[![lodev09](https://avatars.githubusercontent.com/u/6686328?v=4)](https://github.com/lodev09 "lodev09 (10 commits)")

---

Tags

php-libraryphp-ssh2scpssh2phpsftpclassssh2scpmethods

### Embed Badge

![Health badge](/badges/lodev09-php-ssh2/health.svg)

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

###  Alternatives

[idct/sftp-client

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

25241.8k](/packages/idct-sftp-client)

PHPackages © 2026

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